How to install CKAN 2.3 from source on Mac OS X 10.9.5 with Macports

Reuben Cummings edited this page May 25, 2015 · 1 revision

NOTE This page is WIP and not yet completely updated.

Tested with CKAN 2.3

This is based on the Ubuntu 10.04 source install instructions from

  1. Install Macports. Macports is a free third-party package manager for OS X that installs software packages into /opt/local. We'll use Macports to install some of CKAN's dependencies.

  2. Install CKAN dependencies:

    postgresql sudo port install postgresql94 postgresql94-server solr sudo port install solr4 npm and node sudo port install npm node

  3. Install CKAN into a Python virtual environment.

    Recommend the official documents

    a. Create a Python [virtual environment] to install CKAN into, and activate it:

    python virtualenv and virtualenvwrapper sudo pip install virtualenv virtualenvwrapper

    sudo easy_install pip
    sudo pip install virtualenv virtualenvwrapper
    mkvirtualenv --no-site-packages ckan
    workon ckan
    pip install ckan==2.3

    b. Install the CKAN source code into your virtualenv. To install the latest stable release of CKAN(2.3), run:

    pip install ckan==2.3

    or latest:

    pip install ckan'

    c. Starting PostgreSQL on Mac OS X: -- important

    sudo su postgres
    pg_ctl start
    [or] pg_ctl -D /Library/Postgresql/9.3/data start|stop|restart|status

    Check the server is running:

    lsof -i:5432

    TODO How to make PostgreSQL automatically?

  4. Setup a PostgreSQL database: See the Official Document(step 3)

    List existing databases:

    sudo -u postgres psql -l

    a. Create a database user.

    sudo -u postgres createuser -S -D -R -P ckan_default

    b. Create a new PostgreSQL database.

    sudo -u postgres createdb -O ckan_default ckan_default -E utf-8

    It's OK.

  5. Create a CKAN config file

    Create a directory to contain the site's config files:

    sudo mkdir -p /etc/ckan/default
    sudo chown -R 'whoami' /etc/ckan/

    Change to the ckan directory and create a CKAN config file:

    (default): cd /usr/lib/ckan/default/src/ckan
    (default): paster make-config ckan /etc/ckan/default/development.ini

    Edit the development.ini

    vi /etc/ckan/default/development.ini
    sqlalchemy.url = postgresql://ckan_default:<pass>@localhost/ckan_default

  6. Create database tables

    (default): cd /usr/lib/ckan/default/src/ckan
    (default): paster db init -c /etc/ckan/default/development.ini

    You should see Initialising DB: SUCCESS

  7. Link to who.ini

    ln -s /usr/lib/ckan/default/src/ckan/who.ini /etc/ckan/default/who.ini

  8. Install, configure and start Solr:

    # brew tap homebrew/versions
    brew install solr14
    # brew untap homebrew/versions

    Info: You can download Solr other versions and configure it .

    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 /usr/lib/ckan/default/src/ckan/ckan/config/solr/schema.xml solr/conf/schema.xml

  9. Install Tomcat(Using it replace Jetty)

    If you are familiar with solr-jetty configuration, recommend use the Jetty.

    a. Download Apache Tomcat(apache-tomcat-7.0.56.tar.gz)

    tar -zxvf apache-tomcat-7.0.56.tar.gz
    mv apache-tomcat-7.0.56/ /usr/local/apache-tomcat(your path)

    b. Configure Apache Tomcat:

    1. Copy solr.war to tomcat webapp/ directory:

    sudo cp /usr/local/Cellar/solr14/1.4.1/libexec/example/webapp/solr.war /usr/local/apache-tomcat/webapp/solr.war

    1. Starting apache-tomcat, unzip the solr.war:


    1. Closing apache-tomcat:


    1. Configure:

    cd /usr/local/apache-tomcat/webapp/solr/WEB-INF
    vi web.xml

    1. Add the following code:


    Warning: the env-entry-value is solr related configuration and index. (e.g. schema.xml)

    1. Set the apache-tomcat port(default: 8080): -- (optional)

    cd /usr/local/apache-tomcat/conf
    vi server.xml

    <Connector port="8983" protocol="HTTP/1.1" -- set:8983
    redirectPort="8443" />

    1. Running Apache Tomcat:


    Open in a web browser, it does work.

    TODO How to make Tomcat start automatically?

  10. You're done!

    (default):cd /usr/lib/ckan/default/src/ckan
    (default):paster serve /etc/ckan/default/development.ini

    Open in a web browser, and you should see the CKAN front page.


Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.