# WeeWX: Installation on macOS systems

This is a guide to installing WeeWX on macOS.

## Download

Download the source archive weewx-X.Y.Z.tar.gz from weewx.com/downloads.

## Install prerequisites

Ensure that Python 2.7 is installed. Earlier versions will not work.

    python2 -V

Make sure that a Python 2 version of pip has been installed on your system. If not, it may be as simple as:

    sudo easy_install pip

Now install the required Python packages using pip.

    sudo python2 -m pip install pysqlite
    sudo python2 -m pip install configobj
    sudo python2 -m pip install Cheetah
    sudo python2 -m pip install PIL
    sudo python2 -m pip install pyserial
    sudo python2 -m pip install pyusb

    # For extended almanac information (optional):
    sudo python2 -m pip install pyephem

Depending on the macOS and Python versions, you might have to use Pillow instead of PIL.

If the PIL or Cheetah installation fails, you might have to install xcode:

    xcode-select --install

then try the pip install again.

Ensure that Python 3.5 or later is installed.

    python3 -V

If not, Python 3 can be installed using Homebrew:

    brew install python

This will also install the Python 3 version of pip.

Now install the required Python packages using pip.

    sudo python3 -m pip install configobj
    sudo python3 -m pip install Cheetah3
    sudo python3 -m pip install Pillow
    sudo python3 -m pip install pyserial
    sudo python3 -m pip install pyusb

    # For extended almanac information (optional):
    sudo python3 -m pip install pyephem

If the Cheetah3 or Pillow installation fails, you might have to install xcode:

    xcode-select --install

then try the pip install again.

## Install WeeWX

Expand the source archive:

    tar xvfz weewx-X.Y.Z.tar.gz

Change directory:

    cd weewx-X.Y.Z

Modify home in setup.cfg to set the installation location to /Users/Shared/weewx

    perl -pi -e 's%^home.*%home = /Users/Shared/weewx%' setup.cfg

Install:

    python2 setup.py install

    python3 setup.py install

The installer will prompt for a location, latitude/longitude, altitude, station type, and parameters specific to the station.

## Run

Run the main program directly:

    cd /Users/Shared/weewx
    python2 ./bin/weewxd weewx.conf

    cd /Users/Shared/weewx
    python3 ./bin/weewxd weewx.conf

Or as a daemon automatically when the computer starts:

    sudo cp /Users/Shared/weewx/util/launchd/com.weewx.weewxd.plist /Library/LaunchDaemons
    sudo launchctl load /Library/LaunchDaemons/com.weewx.weewxd.plist

## Status

To make sure things are running properly, look in the system log for messages from WeeWX. Run the Console application and select All Messages.

## Verify

After about 5 minutes, open the station web page in a web browser. You should see your station information and data. If your hardware supports hardware archiving, then how long you wait will depend on the archive interval set in your hardware.

    file:///Users/Shared/weewx/public_html/index.html

## Customize

To enable uploads such as Weather Underground or to customize reports, modify the configuration file /Users/Shared/weewx/weewx.conf. See the User Guide and Customization Guide for details.

WeeWX must be restarted for configuration file changes to take effect.

## Start/Stop

To start/stop WeeWX:

    sudo launchctl load /Library/LaunchDaemons/com.weewx.weewxd.plist
    sudo launchctl unload /Library/LaunchDaemons/com.weewx.weewxd.plist

## Uninstall

To uninstall, simply delete the directory /Users/Shared/weewx. This will delete WeeWX, configuration files, and data.

    rm -r /Users/Shared/weewx
    sudo rm /Library/LaunchDaemons/com.weewx.weewxd.plist

## Layout

The instructions above will result in the following layout:

executable: | /Users/Shared/weewx/bin/weewxd
configuration file: | /Users/Shared/weewx/weewx.conf
skins and templates: | /Users/Shared/weewx/skins/
sqlite databases: | /Users/Shared/weewx/archive/
generated web pages and images: | /Users/Shared/weewx/public_html/
documentation: | /Users/Shared/weewx/docs/
examples: | /Users/Shared/weewx/examples/
utilities: | /Users/Shared/weewx/bin/wee_*

© Copyright Tom Keffer