A blog on software engineering by Trevor Brown

Install Erlang 16 on Mac OSX 10.9 With Kerl

I recently was working on a project that required me to connect to an ODBC database. I hadn’t ever worked with ODBC before, but I saw Erlang had an application for interacting with ODBC databases. I fired up the Erlang console and typed odbc:module_info(). but the function was undefined. After double checking everything and trying to start the odbc application I realized that the odbc module wasn’t part of my Erlang installation. I tried reinstalling Erlang but that didn’t fix the problem. Turns out Erlang’s ODBC application relies on unixodbc, which isn’t included on OSX anymore. Here is how you get Erlang R16B03-1 on Mac OSX 10.9.5:

I use Kerl for building and installing Erlang versions. It’s a relatively simple tool that I have found to be very helpful. I am assuming you are using Kerl in the steps below. If you aren’t using Kerl it should still be possible to build Erlang with ODBC support on OSX, but you will need to alter these commands appropriately. I also assume you are using brew.

  1. Brew does all the hard work for us. Run $ brew install freetds. Make sure freetds was installed successfully and then try running $ tsql. If tsql exists it should print out some help information.
  2. We can use brew install unixodbc. Run $ brew install unixodbc. Make sure it installs successfully and then verify by running $ isql. isql should print out some help information.
  3. Install Erlang with Kerl. Before you build Erlang open up ~/.kerlrc (or create it if it doesn’t exist) and make sure it looks like this:

         KERL_CONFIGURE_OPTIONS="--enable-darwin-64bit --disable-hipe --enable-vm-probes --with-dynamic-trace=dtrace --disable-native-libs --enable-kernel-poll --enable-threads --enable-smp-support --with-wx"

    Also, one more thing before running the build command - make sure $GREP_OPTIONS is set to ''. On my system I had customized it and it was causing the build to crash:


    Finally, you should be able to run the build command. Here I chose erlang_16 as the build name:

         kerl build R16B031 erlang_16
  4. If all goes well you should be able to install the build by running kerl install erlang_16 <dir> where <dir> is the directory you want to install the build in. You should now have an installation that includes the odbc application!

If this quick post wasn’t able to help you here are some other resources I found that helped me fix this issue:

Elixir Language

I have been doing Erlang and Elixir programming for the last ten months and I would love to share what I have been learning. It has been quite a change moving from Ruby to a functional language like Erlang. Most of the projects I am working on at work are written Erlang, but I have also been studying Elixir, which is a new language that is built on top the Erlang VM. Since it uses the Erlang VM, it inherits all the strengths of Erlang - concurrency, scalability, and fault tolerance. Elixir is a new language (first major release expected sometime in the next month) with a Ruby-like syntax. It focuses on providing better tooling and allows for much greater productivity than Erlang. If you are interested in building concurrent applications or want to learn functional programming I highly recommend you check it out -

I will also be giving a talk on Elixir at the Tampa Ruby Brigade on Oct. 16. It will be an introduction to Elixir followed by some demos. If you interested in learning more Elixir RSVP on -

I am very excited about Elixir. I think it has very bright future. I believe it very elegantly solves some scalability issues while also providing tooling (and ease of use) that is comparable to Ruby.

If you have any questions or comments I would love to hear from you.