Oisín Hurley's Weblog

old dog, new tricks

Installing Erlang and Elixir on OS X Mavericks

with 5 comments

Homebrew is my go-to tool for non-App Store or prebuilt app installs on Mac, and has been for ages, just because I’ve found it easier to use than fink or macports. There’s been precious little trouble moving to mavericks, but Erlang is one item that didn’t install smoothly for me. The solution was to add a configure switch to specify a later version of OpenSSL that isn’t installed by default on Mavericks (on beta 3 at least). Right now, brew only supports extra configure switches through altering the brew formula, and I didn’t want to muck about with that.

With thanks to Steve Vinoski for some tips on the configuration of the Erlang source code build:

$ brew install openssl

will get a recent version of OpenSSL that Erlang likes. At the end of the install you’ll get a message

Caveats
This formula is keg-only: so it was not symlinked into /usr/local. Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble. The OpenSSL provided by OS X is too old for some software. Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables: LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include

The Erlang source build needs to know about that /usr/local/opt/openssl directory. Go download the Erlang source – if you are intending to install Elixir get the 16B01 version at least. Unpack the source, change into the source directory and issue the build configure like this (line breaks for legibility – paste-able version at this gist).

$ ./configure --disable-hipe 
              --enable-smp-support
--enable-threads
--enable-kernel-poll
--enable-darwin-64bit
--with-ssl=/usr/local/opt/openssl

Once you’ve configured the build, you might want to skip a couple of things – for example wxWindows and ODBC

$ touch lib/wx/SKIP lib/odbc/SKIP
$ make
$ sudo make install

Check that erl has found the crypto module ok

$ erl
Erlang R16B01 (erts-5.10.2) [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
Eshell V5.10.2 (abort with ^G)

1> crypto:start().
ok
2>
User switch command
--> q

Now for Elixir, it’s just a matter of going back to using homebrew and all should behave as expected.

$ brew install elixir
$ iex
Erlang R16B01 (erts-5.10.2) [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
Interactive Elixir (0.10.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> IO.puts("Woot")
Woot
\:ok
iex(2)>

About these ads

Written by oisinhurley

August 25, 2013 at 8:45 pm

Posted in programming

Tagged with , , ,

5 Responses

Subscribe to comments with RSS.

  1. Thanks a bunch for this! I’m trying to get into some erlang myself and sometimes getting things to play nice with pre-release software is kinda hard :)

    sithtoast

    September 4, 2013 at 7:48 am

  2. Excelente blog… ya pude instalar Erlang en Maverick… muchas gracias

    Carlos Erazo

    March 5, 2014 at 3:55 am

  3. Works as described. Thanks Oisín

    lixirolife

    April 20, 2014 at 12:30 pm

  4. .13 isn’t available yet in Brew. Homebrew seemed to cause a great deal of pain to circumvent. I couldn’t really.I ran

    $brew uninstall elixir

    I did a fresh install of Homebrew using the ruby getter in command line,

    Openssl also needs to be reinstalled.

    $brew install openssl

    when you do a fresh install of brew, as I did!!, you still need openssl again.

    then follow the install instructions as per :

    $ git clone https://github.com/elixir-lang/elixir.git
    $ cd elixir
    $ sudo make install

    That should work. Worked for me at least (minus dicking about with firkin home-brew for hours)

    lixirolife

    April 22, 2014 at 1:58 pm

  5. oops, I mean elixir’s make seems to need openssl. I don’t think brew really helps guys. It’s slow to update. Just git clone, reinstall openssl if necessary (you don’t necessarily need Brew to reinstall openssl or anything for that matter), and do a sudo make install. That should do it…

    lixirolife

    April 22, 2014 at 2:05 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 4,172 other followers

%d bloggers like this: