Installing libevent on MAC OSX 10.6

So, today I set about installing libevent on my laptop. It’s a required library for system event handling applications. An example of that would be Gearman.

First off, you are going to need to have install MacPorts installed.

Step 1 – install MacPorts:

Now this is where the fun begins. Now, if you followed my other blog page on installing MacPorts, you can move onto Step 3. If you have not, then, proceed at hast to installing it (follow this link too).

Step 2 – install libevent

If you enjoyed installing MacPorts, you are going to LOVE this! 🙂 Now, the step of building libevent from source, probably not *required* but, after three installs that were not picked up by the gearmand, I though I’d just, do this the old fashioned way too.

First off, run the standard install. This did not toss errors for me on the normal install. You can stop with this Step after it installs and move of if you like. I’m going to show the extra couple of steps I took.

#root: port install libevent

Step 3 – locate tarball, extract and build from source

UPDATE: 6-JUN-2013. Get the latest tarball from [HERE].

Now, move the distribution for libevent, and untar the tarball. The path here is from my current build. The one you eventually get will possibly have a higher number (more recent build). Don’t freak out if this exact path is not on your system. If you are building from source, I’m going to assume you also know how to find things on your computer. The reason I built this from source, was to provide the option –prefix=/usr/local to configure. It establishes where it will deploy it’s libraries.

#root: cd local/var/macports/distfiles/libevent
#root: gunzip libevent-1.4.13-stable.tar.gz
#root: cd /opt
#root: tar xvf libevent-1.4.13-stable.tar
#root: cd libevent-1.4.13-stable
#root: make
#root: make install

Now, you should have a nice clean build of libevent on your computer. Having accomplished this, you can install an array of scheduling and system event driven applications.

Enjoy.

6 thoughts on “Installing libevent on MAC OSX 10.6”

  1. What’s with the line “cd /opt”? Is that intentional? When I tried these instructions everything worked until after that line, and everything worked great when I omitted it.

    Thanks for the great tutorials!

  2. I wanted to mention that while installing libevent from port installs correctly, it’s not in the include path by default. You can add it to the paths by:

    export LIBRARY_PATH=$LIBRARY_PATH:/opt/local/lib
    export CPATH=$CPATH:/opt/local/include

    This will prevent the need to install manually.

  3. Answer to Ken, that cd /opt should be at the start of the first line. Also you cannot run make without first running configure. The instructions above did not work but I got it working with the following.

    #root: cd /opt/local/var/macports/distfiles/libevent
    #root: gunzip libevent-1.4.13-stable.tar.gz
    #root: tar xvf libevent-1.4.13-stable.tar
    #root: cd libevent-1.4.13-stable
    #root: ./configure
    #root: make
    #root: make install

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.