DEV Community

loading...

Setting up elixir for mac (with erlang observer working)

hugomatinho
・2 min read

The erlang observer tool is a fantastic tool for elixir developers to have in their toolbelt, unfortunately the default elixir install on Mac OS Big Sur is broken (actually it's one of the dependencies wxmac which is broken).

if you want to fix it and have it as sexy as the one below ;) read along

Alt Text

This post serves as a memory refresher for later installs and also to help anyone searching to solve this, hopefully it's detailed enough, let me know in the comments if anything isn't as accurate as it should be and feel free to share your insights as well.

What we are going to do

  1. Modify wxmac
  2. Clean up previous elixir/erlang install if any
  3. Install elixir properly with asdf

Modify wxmac

Pop open a terminal window and insert the following command (I'm assuming you use homebrew on a mac and that you use vscode but YMMV)

export HOMEBREW_EDITOR=code
brew edit wxmac
Enter fullscreen mode Exit fullscreen mode

you'll need to change the version, the hash and the args, check the diff file below

With wxmac properly modified if you already have an elixir setup we will need to clear it, if not, skip the next section and let’s proceed to install it properly

Remove previous elixir setup (skip if you have never ever setup elixir previously)

brew uninstall elixir
brew uninstall erlang
brew uninstall wxmac
Enter fullscreen mode Exit fullscreen mode

Install it properly (feel free to update the versions)

brew install --build-from-source wxmac
export KERL_BUILD_DOCS="no"
export KERL_CONFIGURE_OPTIONS="--without-javac --with-ssl=$(brew --prefix openssl)"
export CFLAGS="-O2 -g -fno-stack-check -Wno-error=implicit-function-declaration"
brew install asdf
asdf plugin add erlang
asdf plugin add elixir
asdf install erlang latest
asdf install elixir latest
asdf global erlang 23.1
asdf global elixir 1.10.4-otp-23
Enter fullscreen mode Exit fullscreen mode

That's all folks!

Discussion (3)

Collapse
jan_bentzen profile image
Jan Bentzen

Thank you for this.
Is this possible to do without using asdf?

Collapse
ksangster profile image
ksangster • Edited

Yes, it is possible to do this without using asdf.
During the build/install step, I did the following:

$ brew reinstall --build-from-source wxmac
$ brew reinstall --build-from-source erlang
$ brew reinstall --build-from-source elixir
Enter fullscreen mode Exit fullscreen mode

using:
Wxmac version 3.1.5
Elixir 1.12.1 (compiled with Erlang/OTP 24)

Collapse
hugomatinho profile image
hugomatinho Author

Should be possible as it is a problem with the WxWidgets library on mac but honestly I haven't tested it without asdf