First, Thrift requires Boost, which is not included in OS X by default. Go to the Boost site and download the latest version. Unzip and open Terminal for that folder. The configure script doesn’t seem to work, so we need to work around this. Follow these steps in terminal to install it:
cd ./tools/jam/src/ ./build.sh cp bin.macosxx86/bjam ../../../ cd ../../../ ./bjam --prefix=/usr/local ./bjam install
Next we need to also get pkgconfig, which also isn’t on OS X by default. This assumes MacPorts is already installed:
port install pkgconfig
I’m using this for Facebook Puzzles, so I downloaded the recommended archived version of Thrift from here (direct link) but you can get the latest version from the Thrift download page.
Unzip the archive and open a Terminal window in this folder and do the following commands:
cp /opt/local/share/aclocal/pkg.m4 aclocal ./bootstrap.sh ./configure make make install
Now that thrift is installed, we can make the Thrift scripts for our chosen language. I started by using this for the Simon Says Facebook Puzzle, and I wanted to do it in python, so my Terminal commands looked like:
thrift --gen py simonsays.thrift
Also note that to get my python program to run, I needed to also copy the Thrift python folder to my working directory.