used to rbenv? erlenv is almost exactly the same thing. use erlenv to setup and switch between multiple erlang releases effortlessly. ok maybe some tiny amount of effort required
erlenv is a fork of rbenv and all credit belongs to sam stephenson and the other contributors to rbenv
erlenv allows multiple erlang releases to coexist peacefully, and makes it easy to switch between them on a systemwide, per user or per directory basis
each directory under the directory ~/.erlenv/releases
is considered a release.
you might have ~/.erlenv/releases/r14b04
, ~/.erlenv/releases/r15b01
and
~/.erlenv/releases/github_head
for example
each release is it's own working tree with it's own binaries and applications. erlenv creates shim binaries - simple wrapper scripts - that redirect execution to the currently active release
because of this shim approach, all you need to use erlenv is ~/.erlenv/shims
in your $PATH
- Check out erlenv into
~/.erlenv
.
$ cd
$ git clone https://github.com/talentdeficit/erlenv.git .erlenv
- Add
~/.erlenv/bin
to your$PATH
for access to theerlenv
command-line utility.
For bash
$ echo 'export PATH="$HOME/.erlenv/bin:$PATH"' >> ~/.bash_profile
For zsh
$ echo 'export PATH="$HOME/.erlenv/bin:$PATH"' >> ~/.zshenv
For fish shell
$ echo 'set PATH ~/.erlenv/bin $PATH' >> ~/.config/fish/config.fish
-
Run
~/.erlenv/bin/erlenv init
for shell-specific instructions on how to initialize erlenv to enable shims and autocompletion. -
Restart your shell so the path changes take effect. you can now begin using erlenv.
For bash and zsh
$ exec $SHELL
For fish shell
$ eval $SHELL
- Install releases into
~/.erlenv/releases
. for example, to install OTP R15B01, download and unpack the source, then run:
$ ./configure --prefix=$HOME/.erlenv/releases/r15b01
$ make
$ make install
$ erlenv rehash
- Start using
erlenv
.
$ erlenv
like git
, the erlenv
command delegates to subcommands based on its first
argument. the most common subcommands are:
sets the global release to be used in all shells by writing the version name to
the ~/.erlenv/release
file. this version can be overridden by a per-project
.erlang-release
file, or by setting the ERLENV_RELEASE
environment variable
$ erlenv global r15b01
the special version name system
tells erlenv to use the system erlang (detected
by searching your $PATH
)
when run without a release name, erlenv global
reports the currently configured
global version
sets a local per-project release by writing the version name to an .erlang-release
file in the current directory. this version overrides the global, and can be
overridden itself by setting the ERLENV_RELEASE
environment variable or with the
erlenv shell
command.
$ erlenv local r15b01
when run without a release name, erlenv local
reports the currently
configured local release. you can also unset the local version:
$ erlenv local --unset
sets a shell-specific release by setting the ERLENV_RELEASE
environment variable
in your shell. this release overrides both project-specific releases and the global
release
$ erlenv shell riak-1.1.1
when run without a release name, erlenv shell
reports the current value of
ERLENV_RELEASE
. you can also unset the shell version
$ erlenv shell --unset
note that you'll need erlenv's shell integration enabled (step 3 of the installation
instructions) in order to use this command. if you prefer not to use shell integration,
you may simply set the ERLENV_RELEASE
variable yourself
$ export ERLENV_RELEASE=riak-1.1.1
displays the currently active release, along with information on how it was set
$ erlenv release
riak-1.1.1 (set by /Users/alisdair/riak/.erlang-release)
lists all releases known to erlenv, and shows an asterisk next to the currently active release
$ erlenv versions
r14b04
r14b04-minimal
r15b01
* r15b01-minimal (set by /Users/alisdair/.erlenv/global)
riak-1.1.1
installs shims for all release binaries known to erlenv (i.e., ~/.rbenv/releases/*/bin/*
).
run this command after you install a new release
$ erlenv rehash
displays the full path to the binary that erlenv will execute when you run the given command
$ erlenv which erl
/Users/alisdair/.erlenv/releases/r15b01/bin/erl
lists all releases with the given command installed
$ erlenv whence typer
r14b04
r15b01
riak-1.1.1