Adding Erlang library locations
Thursday, November 13, 2008 at 19:36 by
Jón Grétar Borgþórsson When adding Erlang libraries there are a few possible ways. The easy way is to add the libraries into the directory /usr/local/lib/erlang/lib. All directories there will be added to the library paths by default. The problem with that is that I don't like mixing 3rd party libraries with the core libraries.
Enter the ERL_LIBS environment variable. Set that to a directory and all the subdirectories of it that include code will the added automatically to the code path. To add it open up the file /etc/bashrc and add the following:
ERL_LIBS=/Library/Erlang/lib
if [ -d $HOME/Library/Erlang/lib ]; then
ERL_LIBS=$HOME/Library/Erlang/lib:$ERL_LIBS
fi
export ERL_LIBS
This way all libraries under /Library/Erlang/lib and /Users/JoeUser/Library/Erlang/lib will be added to Erlangs code paths. The libraries will be in priority before the system libraries but after the -pa code paths. Now you can add things like Mochiweb, Eunit, Nitrogen and more under the /Library/Erlang/lib directory.
You could also put this in the file /usr/local/bin/erl



Reader Comments