Installing Thrift on Mac OS X

Posted on 23 Apr 2009.

I recently started playing with Thrift, and the installation process on OS X had some quirks that took me a while to figure out. Install MacPorts, open Terminal and cd to the folder you want to build the code into, then:

    LOG4J_PATH='/opt/local/share/java/jakarta-log4j.jar'
    THRIFT_URL='http://gitweb.thrift-rpc.org/'
    THRIFT_PARAMS='?p=thrift.git;a=snapshot;h=HEAD;sf=tgz'
    sudo port install boost
    sudo port install jakarta-log4j
    echo "thrift.extra.cpath = ${LOG4J_PATH}" > ~/.thrift-build.properties
    curl "${THRIFT_URL}${THRIFT_PARAMS}" > thrift.tgz
    tar xzf thrift.tgz
    cd thrift
    ./bootstrap.sh
    ./configure --prefix=/opt/local
    make
    sudo make install