Install GraalVM on macOS M1

Maksim Ryzhikov
Mar 31, 2022

--

We can download required version of GraalVM using curl

curl --create-dirs --output-dir ~/Library/Java/JavaVirtualMachines -OL https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz

This command will download graalvm-ce-java17-darwin-adm64-22.0.0.2.tar.gz to ~/Library/Java/JavaVirtualMachines. Now we should extract archive’s content by tar

tar xvzf graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz

Now we can add GRAALVM_HOME environment variables to .bashrc or .zshrc

export GRAALVM_HOME="$HOME/Library/Java/JavaVirtualMachines/graalvm-ce-java17-22.0.0.2/Contents/Home"

also, we can add GraalVM bin folder to the PATH . This allows us to easily access executable commands from shell

export PATH="$GRAALVM_HOME/bin:$PATH"

Now we can easily install native-image using gu command

gu install native-image

--

--