Erlang/OTP is available as free software from Open Source Erlang Downloads. Once you have downloaded the Erlang/OTP distribution, you will need to compile it (if on a Unix platform) and install it.
In addition to the brief instructions below, you may wish to consult the Installation Guide.
Unpack the source distribution. Decide where you want Erlang and its libraries installed. For our example, we will assume you want it in
/usr/local/erlang/otp_r11b. Create this directory, as well as a build directory for building the Erlang sources.
From within the top-level directory, type
./Install /usr/local/erlang/otp_r11b. This will configure, build and install the Erlang/OTP distribution.
Add the distribution's
bin directory to your path. You may wish to set this in your shell initialization file.
The distribution is a self-installing
.exe file. Invoke it (for example, by double-clicking on its icon) and answer the prompts.
The Erlang ShellEdit
Erlang comes with a shell which is used interactively when controlling the Erlang environment and developing programs. On Unix, invoke the shell by typing
erl on the command line. On Windows, type
werl on the command line, or double-click the Erlang shortcut icon.
This starts the Erlang system and provides a shell for input and evaluation of Erlang.
Eshell V5.4.13 (abort with ^G) 1>
Your First Erlang CodeEdit
At the shell prompt, type
"hello, world!" followed by a dot (
.). You can follow that up with some arithmetic. Or answer the question "What is six times 9?" in base-13 notation:
1> "hello, world!". "hello, world!" 2> 1 + 2. 3 3> 13#6 * 13#9. 54
When you are ready to exit, you can stop the Erlang system using the
halt() built-in function: