How to Install CKAN 1.7 on OS X 10.7 Lion
Clone this wiki locally
Tested with CKAN 1.7.
This is based on the Ubuntu 10.04 source install instructions from docs.ckan.org.
1. Install Homebrew. Homebrew is a free third-party package manager for OS X that installs software packages into
/usr/local. We'll use Homebrew to install some of CKAN's dependencies.
2. Install some CKAN dependencies:
brew search mercurialtold me to install Mercurial using
easy_install, but those were crashing for me so I downloaded the latest package for OS X from the Mercurial website and installed it that way instead. It seems to have installed Mercurial to
PostgreSQL People have reported that installing PostgreSQL on OS X from source or using the pre-built binary package from the PostgreSQL website works fine. I chose to install it with homebrew, just do
brew install postgresqland then follow the instructions from
brew info postgresqlto set it up.
- If you're getting "could not connect to server: Permission denied" errors when running psql commands, this may be because the version of PostgreSQL that ships preinstalled on OS X Lion is getting in the way of the version you have installed. You can get around this problem by editing your
PATH. Here are some links:
- Before Lion OS X didn't ship with PostgreSQL preinstalled.
python-virtualenv This isn't in Homebrew so I installed it (system-wide) using pip:
sudo pip install virtualenv(you may find that you have to install pip first:
sudo easy_install pip).
wget Install with Homebrew:
brew install wget
- build-essential This is an Ubuntu-specific package that doesn't exist for OS X. On OS X, just make sure you have an up to date version of Xcode installed.
git You can install git with
brew install gitor using the OS X package from the Git website. I found that I didn't have to because it was already installed on my system. I guess it may have come preinstalled with OS X or may have come with Xcode.
svn I found that I already had this on my system as well, but you could install it with
brew install svn
- libxml2-dev, libxslt-dev Homebrew says that these come preinstalled on OS X.
- python-dev, libpq, openjdk-6-jdk I ignored these and didn't have any problems, I guess they may ship preinstalled on OS X or with Xcode.
sudo apt-get install ...commands and let the
pip install ...commands that follow handle installing those dependencies (unfortunately installing the dependencies this way takes quite a long time, and you have to do it every time you create a new virtual environment for CKAN). Summary:
cd ~ virtualenv pyenv . pyenv/bin/activate pip install --ignore-installed -e 'git+https://github.com/okfn/ckan.git#egg=ckan' pip install --ignore-installed -r pyenv/src/ckan/requires/lucid_missing.txt -r pyenv/src/ckan/requires/lucid_conflict.txt pip install webob==1.0.8 pip install --ignore-installed -r pyenv/src/ckan/requires/lucid_present.txt deactivate . pyenv/bin/activate
4. Follow the Ubuntu source install instructions to setup a PostgreSQL database. The only difference was that when I installed PostgreSQL with Homebrew it configured postgres to run under my user account instead of under a 'postgres' user, so I had to remove the
sudo -u postgres from the front of each postgres command.
5. Follow the Ubuntu source install instructions to create a CKAN config file.
6. Install Jetty and start it:
brew install jetty /usr/local/Cellar/jetty/6.1.26/libexec/bin/jetty.sh start
http://127.0.0.1:8080/ in a web browser to check that Jetty's working. To stop Jetty do
TODO How to make Jetty start automatically?
7. Install, configure and start Solr.
You need to switch to the older version of Solr (1.4.1) that CKAN uses (1.4.1 is the nearest still available version of solr to the version provided with Ubuntu 10.04):
brew tap homebrew/versions brew install solr14 brew untap homebrew/versions
Now you need to set solr's schema.xml file:
cd /usr/local/Cellar/solr14/1.4.1/libexec/example sudo mv solr/conf/schema.xml solr/conf/schema.xml.backup sudo ln -s ~/pyenv/src/ckan/ckan/config/solr/schema-1.4.xml solr/conf/schema.xml /usr/local/Cellar/jetty/6.1.26/libexec/bin/jetty.sh restart java -jar start.jar
http://127.0.0.1:8983/solr/ in a web browser to check that Solr's working.
TODO How to make Solr start automatically?
The Ubuntu instructions talk about editing an
/etc/default/jetty file, I skipped that part and didn't seem to have any problems.
8. Follow the Ubuntu source install instructions to create the database tables and the cache and session directories, in short:
paster --plugin=ckan db init mkdir data sstore
9. Load some test data into CKAN:
10. Start CKAN:
paster serve development.ini
http://127.0.0.1:5000/ in a web browser to check that CKAN is working.
11. Follow the Testing for Developers instructions from the CKAN admin guide to run the sqlite and then the postgresql tests to check that everything is working. In short, make sure your virtual environment is activated and then do:
pip install ckanclient nosetests --ckan nosetests --ckan --with-pylons=test-core.ini