Compiling OTP 23.0.4 on MacOS

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 && 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

  • If you want to build this into asdf, add --prefix $ASDF_DIR/installs/erlang/23.0.4 to your configure options. Then run make && make install

Thanks for sharing this. I ran into an issue getting OTP 23 to run on M1. I was able to sidestep the problem by updating to a newer OTP (for a non-nerves project). I’m sure some others are stuck with the older version (for many valid reasons) and will benefit from your notes.