For reasons™, NervesHub needed to be locked to OTP 23.0.4 for a while. However, this is an especially hard version of OTP to get compiled on MacOS, especially for M1 (arm) machines. After lots of testing and pieces gleaned from many resources (including several posts on this forum), these are the steps I landed on.
Note: This disables observer and wx. I didn’t need them and didn’t want to spend the time to get those dependencies available on this host.
- Autoconf needs to be 2.69 -
brew install autoconf@2.69
- For M1/M2 (arm64) - Apply this patch to prevent segfaults on boot (without it, Erlang will seem to start, but segfault the first time you ever have more than 1 parallel process)
git clone git@github.com:erlang/otp && cd top && git checkout OTP-23.0.4
- Run this in your
otp
source repo
CFLAGS="-O2 -g -Wno-error=implicit-function-declaration" \
PATH="/opt/homebrew/opt/autoconf@2.69/bin:$PATH" \
./configure --without-javac --without-wx --without-debugger \
--without-observer --without-cdv --without-et --disable-debug \
--with-ssl=/opt/homebrew/opt/openssl@1.1 --enable-m64-build
make
- If you want to build this into asdf, add
--prefix $ASDF_DIR/installs/erlang/23.0.4
to yourconfigure
options. Then runmake && make install