Monday, 26 April 2010

Installed Erlang on OS X 10.6.3 Snow Leopard

I bought 'Seven Languages in Seven Weeks' and one of those languages is Erlang. The version on Fink is v.12, but the latest is version 13, so I decided to install it myself from source. I discovered the directory path for installation is not allowed to have a space in it, so I made a path with no spaces and downloaded there. First the download and unpack; OS X doesnt have wget by default, but curl is there:

curl 'http://www.erlang.org/download/otp_src_R13B04.tar.gz' -o 'otp_src_R13B04.tar.gz'
tar -xzvf otp_src_R13B04.tar.gz
curl 'http://www.erlang.org/download/otp_doc_man_R13B04.tar.gz' -o 'otp_doc_man_R13B04.tar.gz'

Create the directory for installation:
sudo mkdir -p /sw/erlang


Now configure, make and install:
cd otp_src_R13B04
./configure --prefix=/sw/erlang --enable-threads -enable-smp-support --enable-kernel-poll
make
sudo make install

Copy the documentation into place and extract it there:
cp ../otp_doc_man_R13B04.tar.gz /sw/erlang/
cd /sw/erlang
sudo tar -xzvf otp_doc_man_R13B04.tar.gz
sudo rm otp_doc_man_R13B04.tar.gz

Edit your ~/.bashrc to include the documentation and the new erlang binary in the appropriate paths; I use the 'pico' editor, but the lines you add are:
export PATH=$PATH:/sw/erlang/bin
export MANPATH=$MANPATH:/sw/erlang/man

...and source that script to get the new paths with . ~/.bashrc.
Now type 'erl' to get in the Erlang repl, and 'ctrl-C a' to exit.

No comments: