I’m upgrading from a Mid 2014 MacBook Pro, so this isn’t a fair comparison to recent Intel machines, but if you’re like me and were waiting for a MacBook with a decent keyboard, you’ll see a big speed boost.
Non-scientific comparison - time to compile my ClojureScript project
- Mid 2014 MacBook Pro - 14s
- M1 Pro MacBook Pro (under Rosetta) - 17s
- M1 Pro MacBook Pro (native) - 6s
First, make sure your architecture is reported correctly:
/usr/bin/uname -m
should return arm64
If this doesn’t work, it’s because you’re running this command from a shell (or tmux
) that is running under Rosetta. Change your shell for the following steps.
Install Homebrew as per the instructions here https://brew.sh . It's fine to install again even if you have Homebrew already.
It should ask to install in /opt/homebrew
. If it doesn’t, see the previous step.
Going forward, you’ll be using /opt/homebrew/bin/brew
to install M1 binaries, and /usr/local/bin/brew
to uninstall the old Intel ones.
which brew
should return /opt/homebrew/bin/brew
.
Now you can install all your tools, including Zulu, which is a M1 native version of the JVM
arch -arm64 brew install zulu clojure/tools/clojure leiningen
Optional, but I find it handy to isntall jenv
to manage JVM versions. If you skip this step, you’ll just need to set JAVA_HOME
yourself
arch -arm64 brew install jenv
ls -al /Library/Java/JavaVirtualMachines/ # find the dir for zulu
jenv add /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home
jenv versions # check that zulu is set up
jenv global zulu64-17.0.1
To confirm this all worked, run clojure
or lein repl
and check Activity Monitor. You should see a java
process where the “Kind” is “Apple”, not “Intel”. Enjoy the performance boost!