Erlang Programming/Getting Started

Getting Erlang
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.

Installing Erlang
In addition to the brief instructions below, you may wish to consult the Installation Guide.

Unix
Unpack the source distribution. Decide where you want Erlang and its libraries installed. For our example, we will assume you want it in. Create this directory, as well as a build directory for building the Erlang sources.

mkdir /usr/local/erlang/otp_r11b

From within the top-level directory, type. This will configure, build and install the Erlang/OTP distribution.

Add the distribution's  directory to your path. You may wish to set this in your shell initialization file.

Microsoft Windows
The distribution is a self-installing  file. Invoke it (for example, by double-clicking on its icon) and answer the prompts.

The Erlang Shell
Erlang comes with a shell which is used interactively when controlling the Erlang environment and developing programs. On Unix, invoke the shell by typing  on the command line. On Windows, type  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 Code
At the shell prompt, type  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  built-in function:

4> halt.