My advice is to steer away for the tempting and illusory ease of typing
brew install elixir and
brew install erlang. Using brew is rarely a good solution to installing languages.
It will force you to have only one version of the language to use at any point in time, and when (in the rare, but still plentiful occurring) case of a specific language version being needed for one of your projects, you'll have to fiddle a lot and break your other projects.
Versioned language management is the way to go, to minimise hassle.
At the end of this guide you'll have an environment that:
- can build Elixir and Erlang from source
- is upgradable using only the command line
- can keep multiple versions of Elixir and Erlang around
Install kerl and Erlang####
The first thing to do is to get kerl:
curl -O https://raw.githubusercontent.com/spawngrid/kerl/master/kerl chmod a+x kerl
move it to a directory included in your path:
mv kerl /usr/local/bin/
Configure the options you want it to use to build Erlang:
touch ~/.kerlrc KERL_CONFIGURE_OPTIONS="--disable-hipe --enable-smp-support --enable-threads --enable-kernel-poll --without-odbc --enable-darwin-64bit"
Check that you have autoconf, if not install it with brew:
which autoconf brew install autoconf
When you have kerl, slightly counter intuitively, you have first to build an Erlang version and give it a name and then you can install it.
That allows you to have more than one version of the same Erlang version built with different build settings.
kerl list releases
Choose one of the available releases on kerl.
kerl build <vers> <name>
Check your build was successfull
kerl list builds
Install your build:
kerl install <name> <path>
You also must activate it, which looks like it has to be done every time. You might want to add it to you .bash_profile.
$ . /path/to/install/dir/activate
My reference for the kerl and Erlang install is the Basho docs
Exenv and its plugin elixir-build are what you need for Elixir installation.
Checkout exenv in ~/.exenv
git clone git://github.com/mururu/exenv.git ~/.exenv
Add its executables to the path
$ echo 'export PATH="$HOME/.exenv/bin:$PATH"' >> ~/.bash_profile
Add exenv init to your shell
echo 'eval "$(exenv init -)"' >> ~/.bash_profile
Restart your shell and you'll have exenv available.
Install Elixir-build and Elixir####
Checkout elixir-build in exenv's plugin directory
git clone git://github.com/mururu/elixir-build.git ~/.exenv/plugins/elixir-build
Now you can install Elixir automatically using exenv
exenv install <version>
To see all available versions use exenv
exenv install --list
Elixir versions will be installed into a directory of the same name under
After you have installed Elixir use rehash to install shims for all Elixir binaries known to exenv
To check that Elixir has been install properly run
it will show you all installed Elixir versions.
You can set a version of Elixir local to a directory using
exenv local <version>
You can set a global version using
exenv global <version>
With this your dev environment is installed and you can start to develop with Elixir.
Next: Take your Elixir environment for a spin (Coming soon)