Running Crystal on an M1
Crystal isn’t yet ready to run on a Mac M1. Sad, I know. In the meantime, I found these instructions from Max Fierke to be helpful. His post tries taking you through the whole process of cross-compiling Crystal to arm64 but I didn’t want to have to manage a hand-rolled version. These are the commands that I used to get Crystal running using Rosetta:
# installs the version of Homebrew that works with ARM
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Installs x86 version of homebrew
$ arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ alias ibrew="arch -x86_64 /usr/local/bin/brew"
# make sure the ARM version of homebrew is first in your path
$ export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
$ ibrew install llvm bdw-gc gmp libevent libyaml openssl@1.1 pcre pkg-config
$ brew install llvm bdw-gc gmp libevent libyaml openssl@1.1 pcre pkg-config
$ ibrew install crystal