I Just Wanted to Run :observer on My Mac
tl;dr
On a Mac, if you want to use the Observer GUI for Elixir and Erlang, just use Homebrew's Erlang distribution. It comes with wxWidgets properly configured.
Erlang distributions installed through asdf do not support Observer out of the box. If you install wxWidgets separately through Homebrew, Erlang will complain that wxWidgets was not compiled with the --enable-compat30 flag and is therefore incompatible. (Do not even think about compiling it from source on your own.)
context
Elixir and Erlang ship with a graphical Observer tool that shows how processes interact. This seems very helpful when you have a complex mix of supervisors, GenServers, and processes.
For some reason, I couldn't use it on my Mac. The error message mentioned something about wx, so I looked into it and found this blog post. Following its instructions, I tried installing wxWidgets with Homebrew. The installation failed because a few dependencies were built for x86_64 instead of arm64.
It took me some time to realize that, for some reason, my Homebrew installation targeted x86_64. I don't recall how that happened, but it explained the architecture mismatches I remembered occasionally encountering when adding dependencies. I also had a version of Elixir installed through MacPorts. I removed both MacPorts and Homebrew, then reinstalled Homebrew for the correct architecture.
With the right version of Homebrew in place, I installed wxWidgets again, carefully set environment variables including KERL_CONFIGURE_OPTIONS="--with-wx", and tried to install Erlang and Elixir with the asdf version manager. Erlang failed to install, displaying a message like: “wxWidgets was not compiled with --enable-compat30, wx will NOT be usable.”
So I tried building wxWidgets from source. ChatGPT suggested all the steps: clone the repo and configure it with a few flags, notably --enable-compat30, exactly as the previous error message had indicated.
The configuration script then detected missing submodules, which I downloaded by following its instructions. I repeated this step several times for a handful of missing submodules.
When I finally got the compilation working, I quickly encountered another error: fp.h, required by the built-in libpng, was missing. ChatGPT told me to install libpng through Homebrew and pass a parameter to the configuration script. I did so and reran the script. The same thing then happened with libtiff.
As I was about to give up, I said, “Argh. I just wanted to use :observer.”
At that very moment, ChatGPT finally mentioned the obvious solution, as if it were an afterthought:
Yeah, this rabbit hole is brutal. If your real goal is just :observer, you don’t actually need to hand-build wxWidgets at all. ... Use Homebrew’s Erlang (it comes with the GUI bits working on macOS).
Bruh...
Why didn't you tell me this before I attempted to compile C++ on my own?
