Installing HASS on MacOS (OSX)

Followed the instructions on https://www.home-assistant.io/docs/installation/macos/ and those did not really work for me.
I downloaded Python 3 (latest version which is 3.7.0) and installed it. But then running pip3 install homeassistant failed due to permissions.
I could have run it as sudo but figured that is not really the way to do it. Instead figured out by installing it in a Python virtual environment instead. Further, 2 additional packages need to be installed separately for it to work, otherwise discovery fails.

Following are the steps once Python is installed.

  1. Open Terminal
  2. Create the folder you want to deploy HASS into (with its own Python environment). I chose homeassistant in my home directory:
    mkdir ~/homeassistant
  3. Change to the directory where the folder from step 2 was created in (in my case thus my home directory):
    cd ~
  4. Create the virtual Python environment:
    virtualenv homeassistant
  5. Set Python to the virtual environment:
    source homeassistant/bin/activate
  6. Install Home Assistant
    pip3 install homeassistant
  7. Install additional package netdisco version 2.0.0:
    pip3 install netdisco=2.0.0
  8. Install additional package netifaces
    pip3 install netifaces

Now it is installed. To start Home Assistance:
~/homeassistant/bin/hass

To start it after for example a server reboot, opening a new Terminal window first the virtual environment has to be activated before starting it.
source homeassistant/bin/activate
~/homeassistant/bin/hass

Hope this helps others.

3 Likes

Further, to setup development on MacOS (mainly for executing tox) I also had to do:

Install venv for tox:

pip install tox-venv

Install autoconf; I used HomeBrew for this but there are other methods.

Install HomeBrew:

/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

Install autoconf (I then also included automakers and libtool):

brew install autoconf automake libtool

This to prevent errors:

ERROR: The executable /Users/ehendrix/Documents/GitHub/home-assistant/.tox/pylint/bin/python3 is not functioning
ERROR: It thinks sys.prefix is ‘/Library/Frameworks/Python.framework/Versions/3.7’ (should be ‘/Users/ehendrix/Documents/GitHub/home-assistant/.tox/pylint’)
ERROR: virtualenv is not compatible with this system or executable

and

running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/DTLSSocket
copying DTLSSocket/init.py → build/lib.macosx-10.9-x86_64-3.7/DTLSSocket
copying DTLSSocket/DTLSSocket.py → build/lib.macosx-10.9-x86_64-3.7/DTLSSocket
running build_ext
Running: autoconf
error: [Errno 2] No such file or directory: ‘autoconf’: ‘autoconf’

I still got an error related to bluepy not being able to compile due to for example glib.h missing. I checked and it seems bluepy is no supported on MacOS; thus leaving that one as is. Did not seem to stop the testing. :slight_smile:

Thanks for your help!. Just had to install virtualenv manually for the virtualenv works using command:

pip3 install virtualenv

Also I think you’re missing a “=” in command number 7. Worked when I entered

pip3 install netdisco==2.0.0

So everything works great except when it comes to start Home Assistant. Even when I tried the method showed on the official website I got the same problem. Both ways, I’m stuck at:

INFO (SyncWorker_8) [homeassistant.loader] Loaded configurator from homeassistant.components.configurator

Nothing happen after this. I’m trying to install on a clean Mac OS install with Python 3.7.0.

Do you know what could be the issue?
Thanks a lot!

1 Like

Are you sure that the virtualenv command that you ran was installed for the same python 3.7 installation you have running? Likewise, pip3…

I was running Home Assistant on macOS in a virtual environment with no issues. At the time, I happened to be using python 3.6 from MacPorts. If it was me these days, I think I’d likely use python 3.6, as python 3.7 is pretty new and perhaps all the packages you might want to use might not be available.

However, I think you need to be careful about which, e.g., virtualenv, pip, etc. commands you’re running to ensure they are also using the python you installed vs. the old version that Apple ships. Using the which virtualenv command (or even type virtualenv in the bash shell) will show you the path.

Followed as told, but no directory users/TheShrekMaster5/homeassistant/homeassistant/bin/haas, even though i can click through the directories? i tried running it by clicking, but stuck for a few hours on 2019-06-09 13:25:28 INFO (SyncWorker_15) [homeassistant.util.package] Attempting install of pydeconz==59

Is that line supposed to give a screenful of errors?

error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      
      Cargo, the Rust package manager, is not installed or is not on PATH.
      This package requires Rust and Cargo to compile extensions. Install it through
      the system's package manager or via https://rustup.rs/
      
      Checking for Rust toolchain....
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

EDIT: solved it by doing curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and then closing and reopening my terminal session and starting again.

EDIT2: Also, going to localhost:8123 doesn’t work after it’s started. I had to use 127.0.0.1:8123.

EDIT3: Wait a minute:

To start it after for example a server reboot, opening a new Terminal window first the virtual environment has to be activated before starting it

Does this mean HASS installed this way can’t automatically restart, after say, a power outage? Ugh. That’s not going to work for me.