Skip to content

Guide to running on macOS - 10.15 RC & 10.14 (Mojave) #16

@atchoo78

Description

@atchoo78

By trial and error (lots of both 🤯) I have now managed to assemble a complete guide for running the timebox CLI on macOS in a virtual enviroment with Python 2.7.

For this guide, I'll just assume that you clone this repository or extract its zip to ~/timebox (/Users/yourusername/timebox). Here we go:

First, check that pip is up to date:

python -m pip install --user --upgrade pip
  1. Install virtualenv. As far as I know, all Macs ship with easy_install, so
sudo easy_install virtualenv
  1. From your home dir:
git clone https://github.com/ScR4tCh/timebox.git 

or extract the zip and copy/move its contents to ~/timebox

cd ~/timebox
  1. Create the virtual enviroment and activate it:
virtualenv ~/timebox // or simply "virtualenv timebox"
source bin/activate
  1. Install (some of) the dependencies
sudo -H pip install -r requirements.txt
cd ~/timebox (cd ..)

Now for the tedious part.

  1. You'll need the "osx" folder from the PyBluez rep later on, so we'll start with cloning it and install the fundamentals.
git clone https://github.com/karulis/pybluez.git
cd pybluez
python setup.py install
  1. (Important!) Use the force and pull off some jedi mind tricks on macOS:
cd ~/timebox 
pip install --upgrade git+https://github.com/karulis/pybluez.git#egg=pybluez
sudo -H cp -R pybluez/osx pybluez/lightblue
sudo -H cp -R pybluez/lightblue lib/python2.7/site-packages/
  1. Clean up (delete the temporary pybluez folder)
rm -R pybluez
  1. Do a quick test to check if Bluetooth is working. Save the following to a new .py file and name it bluetooth-test.py. Run the test with python bluetooth-test.py
# simple inquiry example
import bluetooth
import sys

nearby_devices = bluetooth.discover_devices(lookup_names=True)
print("found %d devices" % len(nearby_devices))

for addr, name in nearby_devices:
    print("  %s - %s" % (addr, name))

If there's no error messages, and you are presented a Bluetooth device status report, Bluetooth and Python 2 are now best friends, and you are hereby a certified Jedi. The rest is in the help function and the README (Thanks! @ScR4tCh )

Example:

cd timebox
python timebox.py clock --color #FF0000

Hope this helps anyone. I'm off to see where I can take this further 🙂

Best regards,

Andreas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions