My Erlang setup
Jul 1st, 2009 by phil
When setting up Erlang under OS X I have run into two issues. First, how do I keep multiple versions installed at once? I sometimes have a need to evaluate a new version of the Erlang VM while keeping the old version around “just in case.” In a few instances I had two applications which needed different versions of the VM. Second, where do I install all of the 3rd party Erlang libraries? Unlike with Ruby or Python there is no blessed “site” directory for 3rd party Erlang libraries.
After a little experimentation I was able to set things up in a way that solves both of these issues. Some of the details are a bit specific to Mac OS X, but this method could easily be adapted to any UNIX-like environment. The method involves symlinks so Windows users are probably out of luck.
I decided to install all Erlang related stuff under ~/Library/Erlang to generally conform to OS X conventions. While I chose to install under my home directory, you could also put it in /Library with minimal changes to the process. In the Erlang directory I have two subdirectories: Releases and Site. The general idea is that each Erlang release will live in a subdirectory of Releases named after the Erlang release (i.e., “R13B01”) while 3rd party code goes in Site. Finally, I create a symlink named Current in the Erlang directory and link it to the release that I am currently using.
The final setup looks like this:
Erlang
|-- Current -> Releases/R13B01
|-- Releases
| |-- R12B5
| `-- R13B01
|-- Site
| |-- erlydtl-0.5.2.2
| |-- mochiweb-0.97.1
| |-- nitrogen-0.2.0
| `-- webmachine-1.3
`-- setup.sh
The setup.sh file is sourced in my .bash_profile and it sets up the shell environment:
export ERL_ROOT=$HOME/Library/Erlang/Current
export ERL_LIBS=$HOME/Library/Erlang/Site
export MANPATH=$ERL_ROOT/man:$MANPATH
export PATH=$ERL_ROOT/bin:$PATH
With this setup, all of the libraries in Site are in the Erlang code path and the current Erlang VM is in the shell’s path. I can switch Erlang VMs by changing the symlink to point to a different distribution, but everything else remains the same.
Building Erlang from source is simple. After extracting the source distribution:
$ ./configure --prefix=$HOME/Library/Erlang/Releases/R13B01
$ make
$ make install
You will want to replace the ‘R13B01’ with the name of the distribution you are building.



hello have you looked at erlware
@arthur, I used to use Erlware. Quite frankly, it was more hassle than it was worth.