There are a number of different ways to set up a Erlang development environment.
Erlang/OTP 24 Install
You can find the setup instructions on the official Erlang website:
The "best" way to install is to download the source code and build it yourself on your machine.
Otherwise, Erlang Solutions provides prebuilt packages on various platforms:
In case of Ubuntu, for instance, the best way is to add the Erlang Solutions APT repository and use the APT tool.
$ wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb $ sudo dpkg -i erlang-solutions_2.0_all.deb $ wget https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc $ sudo apt-key add erlang_solutions.asc $ sudo apt install erlang erlang-doc erlang-manpages
Quickly verify the installation:
$ erl Erlang/OTP 24 [erts-12.3.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] Eshell V12.3.1 (abort with ^G) 1> ^C BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution v Erlang (BEAM) emulator version 12.3.1
Now that we have erlang installed on our machine, it is easy to build rebar3, an erlang project and build manager.
$ git clone https://github.com/erlang/rebar3.git $ cd rebar3 $ ./bootstrap $ cp rebar3 ~/bin
$ rebar3 --help Rebar3 is a tool for working with Erlang projects. Set the environment variable DEBUG=1 for detailed output. Several tasks are available: Usage: rebar3 [-h] [-v] [<task>] -h, --help Print this help. -v, --version Show version information. <task> Task to run. as Higher order provider for running multiple tasks in a sequence as a certain profiles. clean Remove compiled beam files from apps. compile Compile apps .app.src and .erl files. cover Perform coverage analysis. ct Run Common Tests. deps List dependencies dialyzer Run the Dialyzer analyzer on the project. do Higher order provider for running multiple tasks in a sequence. edoc Generate documentation using edoc. escriptize Generate escript archive. eunit Run EUnit Tests. get-deps Fetch dependencies. help Display a list of tasks or help for a given task or subtask. new Create new project from templates. path Print paths to build dirs in current profile. pkgs List information for a package. release Build release of project. relup Create relup of releases. report Provide a crash report to be sent to the rebar3 issues page. shell Run shell with project apps and deps in path. tar Tar archive of release built of project. tree Print dependency tree. unlock Unlock dependencies. update Update package index. upgrade Upgrade dependencies. version Print version for rebar and current Erlang. xref Run cross reference analysis. experimental <task>: vendor Turns dependencies into top-level apps local <task>: install Extract libs from rebar3 escript along with a run script. upgrade Download latest rebar3 escript and extract. plugins <task>: list List local and global plugins for this project upgrade Upgrade plugins Run 'rebar3 help <TASK>' for details.
Now that we have a development environment set up, let's try creating a simple program.
- Next Step: Creating the first program in Erlang