Working with ruby and nodejs i’m usual to work multiple versions of these interpreters so i installed rvm and nvm.
For Elixir i looked for the same commodity, 2 projects exenv and kiex seems to be ok but too old so i tried to fall back to asdf.
As the documentation say for most plugins, it is good if you have installed the following packages OR their equivalent on your OS
- macOS: Install these via homebrew coreutils automake autoconf openssl libyaml readline libxslt libtool unixodbc
- Ubuntu: automake autoconf libreadline-dev libncurses-dev libssl-dev libyaml-dev libxslt-dev libffi-dev libtool unixodbc-dev
- Centos: automake autoconf readline-devel ncurses-devel openssl-devel libyaml-devel libxslt-devel libffi-devel libtool unixODBC-devel
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.6.2 && cd ~/.asdf
Now we need to adjust environment
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bash_profileecho -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile
Plugins are how asdf understands how to handle different packages. In order to add Elixir plugin we need first install Erlang plugin.
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git export KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac" asdf install erlang 21.1 asdf global erlang 21.1
After that we can start to think how to install Elixir in the same way
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
You can install the version using: asdf install elixir ref:.
You can then set the local/global version to your new version with asdf local elixir ref- or asdf global elixir ref-.
asdf install elixir v1.7.4 asdf global elixir v1.7.4
This plugin supports elixir escripts adding them to your path just like any other elixir binary. Whenever you install a new escript with mix escript.install you need to asdf reshim elixir in order to create shims for it.
If everything work as expected you should be ready to test you Elixir installation. simply test it by running
elixir -e "IO.puts 'hello world'"
Now we are ready to install phoenix on our system.
you must be sure that you are on Elixir 1.4 and Erlang 18 or later, but if you followed this post not problem otherwise try doing elixir -v
After that you can start installing the framework
mix archive.install hex phx_new 1.4.0
If we don’t have any static assets, or we want to use another build tool, we can pass the
--no-webpack flag when creating a new application and node won’t be required at all.
You can install Node using homebrew on mac however i would suggest nvm to manage multiple version of it.
Now is time to install phoenix template in order to have wverything working well
mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez