Getting started with Erlang programming on FreeBSD


Erlang is a functional programming language invented at Ericsson built to be highly scalable, high available, fault taulerant and it allows you to change code modules at runtime. FreeBSD's stability and Erlang's robustness make a perfect team.

Erlang is gaining more and more popularity due to it's robustness and fault tolerancy. When Facebook baught WhatsApp in Jan 2014, it came to public attention that WhatsApp is built on FreeBSD and Erlang technology that can handles 1.000.000 simulatneous connection with only one server.

Software built on Erlang

Prominent software that is built on Erlang includes

  • Apache CouchDB, a JSON database
  • ejabberd, a massively scalable XMPP server,
  • RabbitMQ, a robust message queue,
  • Riak, a linear scalable NoSQL key-value storage,
  • WhatsApp, the most successful instant messenger

Erlang on FreeBSD

Typically for FreeBSD, you install software through a port or package. I'll assume you to install the package by running pkg install erlang which installs you Erlang/OTP 18.2.x. OTP stands for Open Telecom Platform and is a set of components that make Erlang so great. When I write about Erlang, I really mean Erlang/OTP.

First steps with the interpreter

You start the Erlang interpreter by starting erl. A shell starts and waits for your input. You can quit it by typing q(). The dot is importing because it marks the end of your input and Erlang begins to execute your code.

Display code paths

 # erl
Erlang R16B03-1 (erts-5.10.4) [source] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.4  (abort with ^G)
1> code:get_path().

The Basics

Further links to Erlang programming

A very good resource for Erlang programming is Learn You Some Erlang for Great Good!