HOWTO Install Kegbot on Mac OSX 10.6
From KegbotWiki
Mac Minis can make a great backend system, as they are small, lightweight, and fairly low-power. The OS X platform also includes Apache, which can provide the web frontend. You will need the developer tools, which are included on your Mas OS X install disc.
I've re-ordered some of the setup steps to help you avoid installation problems. These instructions were written on OS X 10.6.6.
Install MySQL on your system
http://www.mysql.com/downloads/mysql/ - Pick up the 64-bit DMG version, then run the installer.
Create Kegbot user & database as per the kegbot instructions
http://www.kegbot.org/docs/user-guide/installation/configure.html#create-the-settings-file
Install Kegbot from source
http://www.kegbot.org/docs/user-guide/installation/kegbot-install.html#install-from-a-source-release
I installed to /kegbot, off of the root, for easy location.
Create Kegbot settings file & database connection
Create your settings file and database connection, but do not populate the databases!
Install Apple XCode developers kit
We need gcc from this package. You only need the xcode toolkit (required) and unix development tools. You can download this from Apple (developer account required), or find it on your OS X Install DVD.
Install mysql-python
We need to download and build the mysql-python connector from: http://sourceforge.net/projects/mysql-python/files/
You will need to edit the setup_posix.py file. On line 26, change mysql_config.path = "mysql_config"
to: mysql_config.path="/usr/local/mysql/mysql_config"
Then run the setup.py script
$ python setup.py build $ sudo python setup.py install
Install the Python Imaging Library
The easiest way I found to install this tool is through MacPorts
Install MacPorts: see http://www.macports.org Install PIL: sudo port install py26-pil Move framework files: su mv /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/* /Library/Python/2.6/site-packages
Run Kegbot setups
kegbot-admin.py kb_setup
kegbot-admin.py createsuperuser
Start Kegbot using DJango test server
http://www.kegbot.org/docs/user-guide/getting-started/running-kegbot.html
You should now have a running Kegbot server. The web interface is still running off of DJango's test server, which is not recommended for production installations. Next we'll run this off of Apache, which is built-in to OS X.
Download and install mod_wsgi
http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-macosx106-ap22py26-3.3.so
Modify your httpd.conf file
The OS X Apache httpd.conf file controls how the Apache web server behaves. It can be found at /etc/apache2/httpd.conf, and you need root permission to modify it. Add the following line to the end of the LoadModule section
LoadModule wsgi_module libexec/apache2/mod_wsgi.so
Then create an Apache Virtual Host to house your Kegweb install. Add the following right after the <Directory /Library/Webserver/Documents> directive.
<VirtualHost *:80>
ServerAdmin kegbot@example.com
WSGIDaemonProcess mykegbot
WSGIProcessGroup mykegbot
WSGIScriptAlias / /kegbot/pykeg/kegweb.wsgi
Alias /media /Library/WebServer/media
Alias /admin_media /Library/Python/2.6/site-packages/Django-1.3-py2.6.egg/django/contrib/admin/media
<Directory />
Options FollowSymLinks
AllowOverride NONE
Order allow,deny
Allow from all
</Directory>
<Directory /kegbot>
Options ExecCGI Indexes FollowSymLinks MultiViews
AllowOverride NONE
Order allow,deny
Allow from all
AddHandler wsgi-script .wsgi
</Directory>
</VirtualHost>
Modify kegweb.wsgi
You will need to clear the VIRTUAL_ENV variable (leave the single-quotes) and set EXTRA_PATHS to
os.path.join(os.environ.get('HOME'), '.kegbot'), '/etc/kegbot',
(note the extra comma at the end)
Restart Apache
sudo apachectl restart or shut off web sharing in the System Preferences / Sharing and turn it back on
Since the Kegweb frontend is now running on port 80 instead of port 8000, be sure to use --api_url=http://localhost/api when starting kegbot_core.py!
Common problems
If you see "Library not loaded: libmysqlclient.18.dvlib" errors, you will need to recreate the symlinks to the files:
> sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib > sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
You may need pyserial to run kegboard_daemon. Obtain it at [1]. You will also likely need to change a kegboard file to pick up the serial location, since it does not appear on the standard /dev/USB0 location.
Locate /Library/Python/2.6/site-packages/kegbot-0.x.y-py2.6.egg/pykeg/hw/kegboard/kegboard.py In this file, find the kegboard_device string and set it to the string found in the arduino IDE environment (mine was /dev/tty.usbmodem621)
