Installing Elixir with Observer Support on macOS Monterey
In the process of upgrading to the latest version of Elixir (1.14.0) in macOS, I ran into an error with wxWidgets during the Erlang portion of the install process. You need wxWidgets to run the Observer, and I wanted to make sure that the Observer was available if I happened to need it.
APPLICATIONS INFORMATION (See: /Users/gabrielcook/.asdf/plugins/erlang/kerl-home/builds/asdf_25.0.4/otp_build_25.0.4.log)
* wx : No OpenGL headers found, wx will NOT be usable
* No GLU headers found, wx will NOT be usable
* wxWidgets was not compiled with --enable-webview or wxWebView developer package is not installed, wxWebView will NOT be available
First, make sure that asdf is installed correctly. I used Homebrew to do this. There are a few different ways to get asdf running, but that’s beyond the scope of this post. If you don’t know what asdf is, you should check it out.
Before you install Elixir, you have to install Erlang.
Ensure you have all of the Erlang asdf dependancies available, according to the asdf-erlang documentation. The easiest way to do this is (in my opinion) with Hombrew. However, instead of using the prebuilt wxWidgets install from Homebrew, build it yourself.
brew install autoconf
brew install firstname.lastname@example.org
brew install --build-from-source wxwidgets
If the wxWidgets install fails, you may need to update your Xcode command line tools. This happened to me.
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
Next, install Erlang 25. The current version at the time of writing was 25.0.4.
asdf install erlang latest
It was at this step, during the Erlang build, that I got the wxWidgets error. Basically,
-build-from-source flag used win installing wxwidgets fixes that.
Now install Elixir 1.14.
asdf install elixir latest
Make sure the new Erlang and Elixir are set as the global versions.
asdf global erlang latest
asdf global elixir latest
Now you can run
iex and verify that the Observer starts.
Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]
Interactive Elixir (1.14.0) - press Ctrl+C to exit (type h() ENTER for help)
You should see the Observer launch in a new window.
Elixir forum thread which had the solution this is based on.
asdf version manager
asdf Erlang plugin
asdf Elixir plugin
Phoenix installation documentation