Tag: Compiling

Installing Scribe on OSX with Thrift 0.5.0

February 15, 2011 » Geek

Update (2011-02-24)

This also works on Ubuntu, with two little tweaks.

First, no need to install libevent from source, just do an apt-get install libevent-dev.

Second, after you install Scribe, you need to add Thrift to the shared library path so it will load.

Just add a new file called /etc/ld.so.conf.d/scribe.conf with this content:

Then run ldconfig and you should be good to go.

I looked for a way to install Facebook’s Scribe on OS X to test out some code I’m writing at work, but I could not find a process that worked for me.

The best I got was by @kpumuk called Installing and Using Scribe with Ruby on Mac OS.

It got me close, but what I outline below got me the rest of the way. Hopefully it will help you (until it breaks too)

Install libevent (2.0.10)

You’ll need the development files for libevent, which you probably don’t have. Grab the latest stable package at http://monkey.org/~provos/libevent/. I used 2.0.10.

This one is easy, just configure and make install.

You might consider using --prefix=/opt/libevent on the configure to keep this libevent separate from any others that might get installed (via brew or ports). If so, be sure to change --with-libevent when compiling Thrift.

Install Thrift (0.5.0)

Now let’s install Thrift. 0.5.0 is the latest stable, and what I used. http://incubator.apache.org/thrift/.

Again, not a tough build, but you need to be sure that you set --with-libevent on configure, otherwise thriftnb won’t be built and you’ll have to do this compile again later when you get stuck in the Scribe build.

Install FB303 (In Thrift source)

You also need FaceBook Baseline (FB303) which is included in the Thrift source code. From your Thrift source directory, do the following:

Install Scribe (> 2ee14d3)

There is a bug fix in Scribe at version 2ee14d3, which fixes a build problem created by Thrift 0.5.0.

So, as of right now you need to get your source for Scribe from github, and after that commit.

Once you have it:

Build Ruby Thrift structures

Okay, everything is installed now! Well, almost. You still need to generate the Thrift bindings if you are going to be using Ruby.

From the scribe source directory:

Copy a config from Scribe

You’ll also need a config file for Scribe, which you can get from the examples directory in the Scribe source.

Again, from the Scribe source root:

Start Scribe!

You are now ready to run scribe, so fire it up!

Test it from Ruby

Now open up an editor and drop this into a Ruby script.

When you run it, you should get a new directory and file in /tmp/scribetest containing your message.

Enjoy!