<<< macOS WeeWX Guides
Installation on OSX 10.9 Mavericks
These instructions for installing weewx, on OSX 10.9 Mavericks). They use the Python utility easy_install. This is the only method that I could get to work on OSX.
By default the installation will place WeeWX in the /home/weewx directory with the following layout:
Install Prerequisites
Ensure that Python2 is installed. Python 2.5, 2.6 OR 2.7 and above will work, but Python 3 will not.
$ python -V Python 2.7.5
First install Xcode, this is required for the C compiler, Once that has installed you need to also activate the developer tools which is done with the following command.
$ xcode-select-install
Before installing the Python libraries we need to remove any existing Cheetah installations, if they exists.
$ cd /Library/Python/2.7/site-packages $ sudo mv Cheetah-2.4.4-py2.7.egg/ Cheetah-2.4.4-py2.7.egg.old
Now you can install required python packages using easy_install;
# required packages: $ sudo easy_install configobj $ sudo easy_install cheetah $ sudo easy_install PIL $ sudo easy_install pyusb $ sudo easy_install pyserial $ sudo easy_install pyephem
Installation
First change directory to wherever you want to install Weewx. I have used a test area under my own login area for all my testing, and I then move the installation to a secure area from which the WEB site is delivered. I would recommend that you follow a similar strategy and definitely do not expose your local area to the internet.
$ cd /Users/Mike/Weewx/
Then unzip the archive file and change into the directory that this creates
$ tar xvf weewx-X.Y.Z.tar.gz $ cd weewx-X.Y.Z
Now you get the chance to change where WeeWX is installed by editing setup.cfg as shown below. You don’t have to use vi, TextEdit works just as well, just be careful about any auto formatting the TextEdit does.
$ vi setup.cfg # Configuration file for WeeWX installer. The syntax is from module # ConfigParser. See http://docs.python.org/library/configparser.html [install] # Set the following to the root directory where WeeWX should be installed home = /Users/Mike/Weewx/current # Given the value of 'home' above, the following are reasonable values prefix = exec-prefix = install_lib = %(home)s/bin install_scripts = %(home)s/bin
Then build and install:
$ ./setup.py build $ sudo ./setup.py install
Post Installation
Before WeeWX will work successfully on OSX there are a number of changes to make
Fonts
First you need to fix some issues with the location of Fonts within OSX. This is done by editing skin.conf in the skins ➠ Standard directory and make the following changes to all lines containing the FreeMonoBold font. The Courier New Bold font is the closest match from the MAC library and note that you need the enclosing quotes to encapsulate the spaces
Important Note
I have discovered an anomaly with the way fonts are read on OSX. If you look closely at the code below you will spot that the quotes around the fonts definition are not normal quotes but are in fact Single Opening and Closing Quotes, which can be created on the MAC keyboard by pressing ⌥ Opt + ] and ⌥ Opt + ⇧ Shift + ]. Alternatively if you enter normal single quotes ‘ in Tex Edit then TextEdit automatically converts the quotes for you.
After extensive test I have discovered that the Single Opening and Closing Quotes, as shown in the example below, are the only quotes that work.
$ cd /Users/Mike/Weewx/current/skins/Standard $ open -a TextEdit skin.conf ############################################################################### [ImageGenerator] # top_label_font_path = /usr/share/fonts/truetype/freefont/FreeMonoBold.ttf top_label_font_path = ‘/Library/Fonts/Courier New Bold.ttf’ top_label_font_size = 10
Server Uptime
Note: This step is no longer required as the changes have been rolled into version 2.6.2 of weewx.
The Server Uptime command in Station.py is Linux specific and doesn’t work on OSX, so in order to have your page accurately report the server uptime you need to make the following changes.
First find and edit the station.py file
$ cd /Users/Mike/Weewx/current/Weewx/bin/weewx $ vi station.py
Then add the following line to the top of the file
"""Defines (mostly static) information about a station.""" import time import weeutil.weeutil import weewx.units from Quartz.QuartzCore import *
Then search for the following line
# The following works on Linux only: try: os_uptime_secs = float(open("/proc/uptime").read().split()[0]) self.os_uptime = weeutil.weeutil.secs_to_string(int(os_uptime_secs + 0.5)) except (IOError, KeyError): self.os_uptime = ''
And change it to the value shown below
# The following works on OSX only: try: os_uptime_secs = CACurrentMediaTime() self.os_uptime = weeutil.weeutil.secs_to_string(int(os_uptime_secs + 0.5)) except (IOError, KeyError): self.os_uptime = ''
Testing The Programme
You can run the main program from the command line as shown:
$ cd /Users/Mike/Weewx/current $ ./bin/weewxd weewx.conf
After the time period that is set for your archive, the default of which is normally 5 minutes, you should see a new directory created in the current directory named public_html. This is where all the output is created.
Double click file:///Users/Mike/Weewx/current/public_html/index.html to see the fruits of your labour
Managing the Log File
This is documented here
Run The Programme as a Service via Launchctl
This is documented here