Install GraalVM and Native-Image on an M1 Mac (Java11)

This is a quick guide on installing GraalVM on your M1 Mac – this guide also works for x86_64 Macs also.

This will install GraalVM for Java11 – different Java versions are available here: https://github.com/graalvm/graalvm-ce-builds/releases


Install GraalVM using Homebrew

brew install --cask graalvm/tap/graalvm-ce-java11

export JAVA_HOME=$HOME/Library/Java/JavaVirtualMachines/graalvm-ce-java11-22.0.0.2/Contents/Home

Give GraalVM permission to run

xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-ce-java11-22.0.0.2

Install using sdkman

SDKMAN is a brilliant tool, you can install it here: https://sdkman.io/install

sdk install java 22.0.0.2.r17-grl

export JAVA_HOME=$HOME/.sdkman/candidates/java/22.0.0.2.r17-grl

Install native-image plugin

Firstly update your path

Brew version:

export PATH=/Library/Java/JavaVirtualMachines/graalvm-ce-java11-22.0.0.2/Contents/Home/bin:"$PATH"

SDKMAN version:

export PATH=$HOME/.sdkman/candidates/java/22.0.0.2.r17-grl/bin:"$PATH"

You can now install the native-image plugin via the gc command.

gu install native-image

Leave a Reply