Luckily installing Elixir on Os X (Yosemite 10.10, that I’m running) is super simple with Homebrew:
Or is it …
Not for me as it turns out. I hope you had a better fate. This is my story.
Becasue when that was all done I ran
elixir -v to check my version number and got:
In the output from Homebrew I saw just a little warning but nothing that was particularly scary. So I did what every professional programmer does; searched the Internets. And on GitHub I found this issue for Elixir, which sounds exactly like that I was looking for.
Ok… it seems like my version of Erlang, since Elixir “leverages the Erlang VM” was out of date.
But when I ran (in all honestly after I’ve spent ca 45 minutes finding out how to start anything Erlang):
erl, to run the Erlang interperator, it looked great:
Erlang is doing great. Hmmm… Could it be a old version of Erlang? Erlang is also installed with Homebrew, so I tried to install it again and hopefully update it:
brew install erlang. Now it got interesting:
Installing a package with Homebrew consists of several step: download, install and linking (I think). One of the steps has failed. This was the little warning I got when I installed Elixir as I mentioned above.
Luckily you can
link a package after it’s been downloaded. For example
brew link erlang, or to force it
brew link --overwrite erlang.
And do not try
sudo in front of it. Homebrew doesn’t think that’s a good idea and tells you with a hilarious error message…
But what did it say?
/usr/local/lib/erlang is not writable. Maybe I can help it?
Yak-shaving: Os X
Ha! Writable my aXX! I can fix that:
sudo chmod -R 777 /usr/local/lib/erlang.
Sadly that didn’t help much. The linking command from above (
brew link --overwrite erlang), still failed with the same error (
/usr/local/lib/erlang is not writable).
And the folder, and sub-folders (the
-R-switch), was indeed writable.
Yak = shaved clean
What to do? Well, out of a whiff I just tried:
brew reinstall erlang again. And it worked.
When you do a
brew reinstall the old installation is removed first. This basically just
uninstall and then directly
install a formula.
My thinking is that I had, for some reason, an older version of Erlang installed. Maybe even failed install. When Homebrew tried to install a new version of Erlang it failed, since the folders was not writable. When I made them writable the
Just for good measures I actually did a
brew reinstall elixir too. Just to make sure that the dependencies was in good order.
After that I could start coding Elixir. This is the full extent of my Elixir knowledge. Strap in:
Yeah. This tool looks amazing!
Thanks to the Stockholm Elixir Slack-group that listen to me while I hammered away to fix this.
Published byon Last updated