Recently, I decided to start learning Elixir. The first step in learning any language is to install the required tools. While installing elixir on a mac m1 machine, I ran into a lot of problems. This post is a quick guide on the issues I faced and how to fix them.
In retrospect, I should have not installed Elixir directly but should have installed Elixir via Nix. If you want a guide on that, check out this post by Rakshan.
If you anyway want to install Elixir directly, read on to find out the issues I faced. Hopefully, most of these issues should be fixed, but as of writing this post (October 2021), these issues are still present.
brew is pointing to
softwareupdate --all --install --force to update it.
If you try to install Elixir using
brew install elixir as suggested in the official docs, it will get installed, but you might face
segmentation fault after installing and running
elixir --version. If that’s happening to you as well, check out this StackOverflow Question.
These are the steps you need to follow:
asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git
asdf install erlang latest and wait for erlang to build.
asdf global erlang latest
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
asdf install elixir latest
asdf global elixir latest
elixir --version to test the installation.
While trying to install Erlang, I faced a OpenSSL error -
This can be fixed by adding KERNEL CONFIG FLAG
I faced another error after fixing this one -
gen/wxe_wrapper_5.cpp:2165:29: error: taking the address of a temporary object of type 'wxBitmap' [-Waddress-of-temporary]
tar -xzvf otp_src_24.0.tar.gz
tar -czvf otp_src_24.0.tar.gz otp_src_24.0.
asdf install erlang latest again.
If you face any more errors that mention openssl or java, update the
export KERL_CONFIGURE_OPTIONS="--with-ssl=/opt/homebrew/opt/[email protected] \ --with-wx-config=/opt/homebrew/opt/[email protected]/bin/wx-config \ --without-javac"
After this, Erlang should be installed. Install elixir as mentioned in the above steps. Make sure the elixir version u are installing is compatible with the erlang version you have installed. You can find the compatibility table here.