after upgrading Elixir and Erlang 26 with homebrew, installing Phoenix causes a segmentation fault:
$ mix archive.install hex phx_new
Resolving Hex dependencies...
Resolution completed in 0.017s
New:
phx_new 1.7.7
* Getting phx_new (Hex package)
All dependencies are up to date
Compiling 11 files (.ex)
Segmentation fault: 11
How can this be fixed?
after some digging, I found that homebrew was configured for x86 architecture with Rosetta active, instead arm64.
To check your CPU architecture, run uname -m
$ uname -m
arm64
Check your homebrew configuration:
$ brew config
...
macOS: 13.4.1-x86_64
CLT: N/A
Xcode: 14.3
Rosetta 2: true
to switch it to arm64, run:
eval "$(/opt/homebrew/bin/brew shellenv)"
then verify that the architecture is configured correctly:
$ brew config
...
macOS: 13.4.1-arm64
CLT: N/A
Xcode: 14.3
Rosetta 2: false
Then reinstall Elixir and Erlang
brew reinstall elixir erlang
and install Phoenix via mix archive.install hex phx_new