Oisín Hurley's Weblog

old dog, new tricks

Posts Tagged ‘osx

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)>

Advertisements

Written by oisinhurley

August 25, 2013 at 8:45 pm

Posted in programming

Tagged with , , ,