Hopefully this is of use/interest to someone.
How I got Elixir/Phoenix working on an Apple M1
[MacBook Pro (M1 2020), chip Apple M1, MacOS Big Sur 11.3.1]
I installed the latest Elixir/OTP with Homebrew
$ brew install elixir
but found that my Phoenix projects wouldn’t run.
Eg. GitHub - pdxrod/article_editor
failed with
** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
So I tried starting with a simpler project,
This had a different issue, to do with Mongo and its Elixir driver
{:mongodb, "~> 0.5.1"}
https://hexdocs.pm/mongodb/readme.html
The latest Elixir downloaded by Homebrew was 1.12.1, with Erlang/OTP 24. My project was created using Elixir 1.11.2, with Erlang/OTP 23.
The MongoDb driver 0.5.1 uses crypto.hmac/2, and OTP 24 wants crypto.hmac/3, so the project wouldn’t compile and run.
** (UndefinedFunctionError) function :crypto.hmac/3 is undefined or private
Attempts to upgrade plug_crypto, as recommended here, made no difference.
I couldn’t figure out how to downgrade Elixir and Erlang using Homebrew, asdf, kiex, kurl or exenv. So I deleted all copies of both, and switched to using Macports.
sudo port install erlang @23.1
sudo port install elixir @1.11.2
mix deps.get
mix phx.server
Bingo!
This tells you how to install a given version of something with Macports
I installed Macports by finding MacPorts-2.7.1-11-BigSur.pkg here
Release MacPorts 2.7.1 · macports/macports-base · GitHub downloading and double-clicking on it.
Downgrading to Elixir 1.11 isn’t a permanent solution, so I’m going to look into other Mongo drivers, so see if any of them work with 1.12.