Erlang Language Installation Build and Install Erlang/OTP on OpenBSD


Example

Erlang on OpenBSD is currently broken on alpha, sparc and hppa architectures.

Method 1 - Pre-built Binary Package

OpenBSD let you choose desired version you want to install on your system:

######################################################################
# free-choice:
######################################################################
$ pkg_add erlang
# a       0: <None>
#   1: erlang-16b.03p10v0
#   2: erlang-17.5p6v0
#   3: erlang-18.1p1v0
#   4: erlang-19.0v0

######################################################################
# manual-choice:
######################################################################
pkg_add erlang%${version}
# example: 
pkg_add erlang%19

OpenBSD can support multiple version of Erlang. To make thinks easier to use, each binaries are installed Erlang version in its name. So, if you have installed erlang-19.0v0, your erl binary will be erl19.

If you want to use erl, you can create a symlink:

ln -s /usr/local/bin/erl19 /usr/local/bin/erl

or create an alias in your shell configuration file or in .profile file:

echo 'alias erl="erl19"' >> ~/.profile
# or
echo 'alias erl="erl19"' >> ~/.shrc

You can now run erl:

erl19
# or if you have an alias or symlink
erl
# Erlang/OTP 19 [erts-8.0] [source] [async-threads:10] [kernel-poll:false]
# 
# Eshell V8.0  (abort with ^G)

Method 2 - Build and install using ports

 RELEASE=OPENBSD_$(uname -r  | sed 's/\./_/g')
 cd /usr
 cvs -qz3 -danoncvs@anoncvs.openbsd.org:/cvs co -r${RELEASE}
 cd /usr/ports/lang/erlang
 ls -p 
 # 16/ 17/ 18/ 19/  CVS/  Makefile  Makefile.inc  erlang.port.mk
 cd 19
 make && make install

Method 3 - Build from source

Build from source require additional packages:

  • git
  • gmake
  • autoconf-2.59
pkg_add git gmake autoconf%2.59
git clone https://github.com/erlang/otp.git
cd otp
AUTOCONF_VERSION="2.59" ./build_build all

References