Erlang and Elixir on Apple Silicon/M1 Chip

Hello all!

I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily driver.

Wondering if anyone out there has had any luck installing elixir and Erlang using a version manager like asdf? I’ve been trying but getting a few build errors. If it takes considerable effort I’ll probably remote into a server to do whatever elixir development I need to until its more documented and better supported.

Thanks

3 Likes

Try compiling it from the GitHub repo, in particular, the maint branch, as there have been some fixes related to BigSur recently: https://github.com/erlang/otp/pull/2865

9 Likes

Thanks Jose!

I was able to get everything working by installing homebrew using rosetta 2. I followed this guide: https://soffes.blog/homebrew-on-apple-silicon

Still haven’t had much success installing older versions or using ASDF but 1.11 will work for what I need.

4 Likes

Homebrew has a compatibility tracker for several formulae.

1 Like

Speaking of which, I wonder if the ERTS would work fine with asymmetric cores.

I see no reason why not, all is up to the system scheduler. It can be tested on LITTLE.big architecture from ARM (M1 uses similar approach).

Hi @albydarned,

I plan to buy an M1 Pro. My development is now pretty much only Elixir (Phoenix/LiveView etc). So if I can install Elixir using Homebrew (with Rosetta2), it seems I can push the Order button.

Am I right?
Thanks,
Dan

I have an experimental project that is a one click install of OTP+Elixir that you might find helpful:

$ curl -L -O https://wojtekmach.github.io/beamup/install.sh && bash install.sh

The script simply downloads precompiled OTP & Elixir releases. See https://github.com/wojtekmach/beamup. Currently the only available OTP release is 23.1.4 on , darwin-x86_64, darwin-arm64, linux-x86_64, and linux-armv7l (built on rpi4).

If you have a Mac with M1, this should work out of the box natively as well as via Rosetta 2.

As I mentioned initially, this is just a proof of concept. I had brief discussion with members of OTP team on attaching pre-compiled builds to new OTP releases, for macOS in particular. If GitHub ever exposes darwin-amd64 as a target, we’d definitely take advantage of that too.

That being said, you’d most likely want to use Homebrew for other things so it might make sense to use the unofficial support or wait for the official one. I’m personally trying out MacPorts this time around and it seems to work pretty well though it can’t install erlang yet.

3 Likes

NIce! The “about” link seems to be incorrect though.

thanks, fixed!

Has anyone here had success installing older versions of elixir or OTP?

Using brew to install elixir 1.11 has worked great, but I have some older projects I want to support.

Have you tried with asdf? There is an issue with OTP on BigSur but we can bypass that following https://github.com/asdf-vm/asdf-erlang/issues/161#issuecomment-731558207

1 Like

Getting closer! Trying to install OTP 19.2 these are my results:

Followed this guide to create a rosetta terminal shortcut: https://osxdaily.com/2020/11/18/how-run-homebrew-x86-terminal-apple-silicon-mac/

Followed your link to edit the build and ran all commands in the rosetta terminal: https://github.com/asdf-vm/asdf-erlang/issues/161

Now i’m getting this error:

Build failed.
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/netinet6/in6.h:215:30: note: previous declaration is here
extern const struct in6_addr in6addr_loopback;

Something to do with xcode tools related to this issue: https://github.com/asdf-vm/asdf-erlang/issues/158

So far i’ve gotten 1.11 working using homebrew using the link I posted above. I don’t know if there are any nuances but it seems to be working.

1 Like

I just used Migration Assistant to transfer everything from my 2017 MBP to my new Mac mini. Whatever I had running with Elixir on the old system just works for me. I presume this is Rosetta 2 magic.

I had to launch VSCode twice. The first time the Elixir LS plugin crashed. Second time, no issues.

I’ve not tried to recompile or install the latest version yet. Was holding off for official main branch support because what I have works just fine for now.

1 Like