Update: [2021-01-24] The workarounds in this blog post are now obsolete, as openjdk, yuicompressor, and emscripten are now available in ARM homebrew.

On Mac, Emscripten is available in the Intel version of Homebrew, but not the ARM version of Homebrew. I use Emscripten rarely enough that this doesn't bother me. However, I thought I'd try compiling it on the ARM version.

I couldn't get openjdk working in ARM homebrew, but I was able to get emscripten installed in ARM homebrew by using the Intel/Rosetta version of openjdk:

# install intel version of these dependencies, under rosetta
/usr/local/bin/brew install openjdk yuicompressor

# install arm version of these dependencies
/opt/homebrew/bin/brew install python@3.9 node cmake

# trickery: point to the intel version of openjdk, yuicompressor
ln -snf /usr/local/opt/openjdk /opt/homebrew/opt/
ln -snf /usr/local/opt/yuicompressor /opt/homebrew/opt/

# install arm version of emscripten from source
/opt/homebrew/bin/brew install -s emscripten --ignore-dependencies

# trickery: point to the arm version of emscripten
ln -snf /opt/homebrew/opt/emscripten /usr/local/opt/

I'm sure this is *not* recommended but … it seems to be working so far!

Labels: ,