As I said previously, I want to make my posts very short and concise and this is not going to be the exception.
If you're using Windows, I highly recommend install WSL so you will have the best of Linux and Windows at the same time.
Having said so, the commands I show here will work for MacOS, Linux and Windows(WSL).
I highly recommend installing Elixir with asdf
since if you are lucky enough to work with Elixir in a professional project, you might find yourself changing the version several times, so for me, this is the best option for doing it so. So this guide will show you how to do it with asdf
The first thing you're going to do is install Homebrew (I know, you can install it directly as the official web page says, but I think it's way easier using Homebrew instead)
So, step 1. Install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Remember to add brew to your .zshrc
.bashrc
... file (or the one you're using).
export BREW_HOME="/home/linuxbrew/.linuxbrew/bin"
export PATH="$PATH:$BREW_HOME"
Step 2, install asdf:
brew install asdf
Step 3, add Erlang and Elixir plugin with asdf:
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
Step 4, install the latest Erlang and Elixir versions (or the one you want)
asdf install erlang 25.3
asdf install elixir 1.14.4
And that's all, you can change locally or globally your Elixir version with a single command.
Remember to add to your .bashrc
(or the one you're using) the shims from asdf
export PATH=~/.asdf/shims:$PATH
You can type iex
at your terminal to make sure that everything went well:
iex
Erlang/OTP 24 [erts-12.0.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit]
Interactive Elixir (1.13.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
Note: as you might see I have Elixir 1.13.1 and Erlang 24.
Edit 1:
I added the .bashrc
to the files to add the Homebrew variables
I added the shims path.
Thanks for reading! My goal is to make Elixir accessible and easy to understand for everyone. If you have any questions or feedback, please don't hesitate to reach out. And be sure to check back regularly for more articles on https://dev.to/calbertora, as I strive to make each post as clear and readable as possible.
Top comments (0)