Erlang R17-rc1 on OSX Mavericks With WX and a Working Observer

Update 15 April 2014 Erlang/OTP 17.0 is released. Read the updated HOWTO here.

Update 11 Feb 2014 Dan GudMundsson pointed out that starting with R17 both 32 and 64 bit Erlang will work with wxWidgets. I’ve updated part of this blog post with the instructions found in the official Erlang/OTP installation HOWTO.

This post is based on HOWTO: Getting wx to work with Erlang r16b02 on OS X by Martin Schuerrer

Erlang R17-rc1 is ‘the best Erlang yet’ and contains two significant language changes: Maps and named arguments in funs.

Erlang uses wxWidgets, a cross platform GUI library for it’s GUI tools. This build dependency was hard to get working pre-R17, especially for 64-bit Erlang. However, R17 brings double rainbows and care bears for everyone that reads this HOWTO. So Enjoy!

Set correct Xcode path for compilation

1 $ xcode-select -s /Applications/Xcode.app/Contents/Developer

or if you installed a beta version (in my case 51-Beta5 ):

1 $ xcode-select -s /Applications/Xcode51-Beta5.app/Contents/Developer

Install wxWidgets

wxWidgets is a Cross Platform GUI library that’s used by Erlang for applications like Observer.

Execute this line and get some coffee, walk the dog, take out the trash and/or play with your kids. Compilation takes a while.

1 2 3 4 5 6 $ curl -O http://optimate.dl.sourceforge.net/project/wxwindows/3.0.0/wxWidgets-3.0.0.tar.bz2 $ tar xvjf wxWidgets-3.0.0.tar.bz2 $ cd wxWidgets-3.0.0.tar.bz2 $ ./configure --with-cocoa --prefix = /usr/local $ make && sudo make install $ export PATH = /usr/local/bin: $PATH

Check that you got the correct wx-config

1 $ which wx-config

Install kerl

Kerl is a utility that helps you build and manage multiple instances of Erlang/OTP.

1 2 $ curl -O https://raw.github.com/spawngrid/kerl/master/kerl $ chmod a+x kerl

Create ~/.kerlrc . I use $ vim ~/.kerlrc .

Add these lines:

1 KERL_CONFIGURE_OPTIONS = "--disable-debug --without-javac --enable-shared-zlib --enable-dynamic-ssl-lib --enable-hipe --enable-smp-support --enable-threads --enable-kernel-poll --with-wx"

Build & Install Erlang with kerl

1 2 $ kerl update releases $ kerl build 17.0-rc1 17rc1

For a 32-bit Erlang prefix kerl build with CPPFLAGS :

1 $ CPPFLAGS = "-arch i386" kerl build 17.0-rc1 17rc1

Install:

1 $ kerl install 17rc1 ~/17rc1

Activate:

1 $ . ~/17rc1/activate

And bliss out on your new wx-enabled Erlang:

1 $ erl -s observer start