Skip to content

Instantly share code, notes, and snippets.

@allenwyma
Created March 8, 2019 05:04
Show Gist options
  • Save allenwyma/fe515e49e1622223f455b0474e5ef391 to your computer and use it in GitHub Desktop.
Save allenwyma/fe515e49e1622223f455b0474e5ef391 to your computer and use it in GitHub Desktop.

Elixir installation guide

Version numbers should be the ones you want. Here I do it with the last ones available at the moment of writing.

Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to a specific version, you will need to compile it yourself. Then asdf is your best friend.

Make sure XCode tools are installed

xcode-select --install

Install homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Commands

brew install wxmac

Java integration (Optional)

brew cask install java

FOP integration (Optional, requires Java)

brew install fop

Install asdf and its plugins

asdf lives in https://github.com/asdf-vm/asdf

Follow its installation instructions, which at the moment of writing were:

brew install asdf
echo -e '\n. /usr/local/Cellar/asdf/0.7.0/asdf.sh' >> ~/.bashrc

*Note that the above assumes you have version 0.7.0 installed. Please check for the proper directory by using:

brew info asdf

On a new terminal, install Erlang and Elixir plugins:

asdf plugin-add erlang
asdf plugin-add elixir

Install Erlang and Elixir

asdf install erlang 21.2.6
asdf install elixir 1.8.1-otp-21

Then set them as the global version:

asdf global erlang 21.2.6
asdf global elixir 1.8.1-otp-21

Now you can open a new terminal and try erl:

$ erl
Erlang/OTP 21 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V9.3  (abort with ^G)
1> 

Or start Erlang Observer by erl -s observer start.

And you can try 'iex':

$ iex
Erlang/OTP 21 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]

Interactive Elixir (1.8.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>

Use asdf .tool-versions file to manage which version is active on each of your projects.

Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment