Evernote Tech

Building Apache Thrift on Mac OS X

If you follow this blog, you’re already well aware that the Evernote API is built on the Apache Thrift framework. Our client SDKs give you everything you need to use the API, so most developers don’t actually have to understand much about Thrift. From time to time, though, somebody wants use our Thrift IDLs to compile their own client-side code. Most of our engineers use Macs, and we’ve found that building the Thrift compiler on OS X can be a bit of a challenge. So that we won’t forget how to do it next time, and to help you if you’re trying to do it yourself, here are the basic steps to build Thrift from source on OS X:

  1. Grab the latest Thrift distribution (currently 0.9.0) from http://thrift.apache.org/
  2. Install Xcode from the Mac App Store
  3. Launch Xcode, open the Preferences, select Downloads, and install the “Command Line Tools for Xcode” component.
  4. Install Homebrew
    ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
    brew doctor
  5. Use Homebrew to install autoconf, automake, libtool and pkg-config
    brew install autoconf automake libtool pkg-config
  6. Use Homebrew to install Boost
    brew install boost
  7. Open compiler/cpp/src/thriftl.ll and change
    #include "thrifty.h"

    to

    #include "thrifty.hh"
  8. Build Thrift
    bootstrap.sh
    configure
    make

You’ll find the Thrift compiler at compiler/cpp/thrift. To compile the Evernote API IDLs, simply run the following command, where “lang” is the programming language that you’re compiling for:

compiler/cpp/thrift -r --gen lang NoteStore.thrift

Upgrade your notes with Evernote Personal.

Go Personal