DEV Community

Maksim
Maksim

Posted on • Originally published at maksimrv.Medium on

Install GraalVM on macOS M1

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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"
Enter fullscreen mode Exit fullscreen mode

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"
Enter fullscreen mode Exit fullscreen mode

Now we can easily install native-image using gu command

gu install native-image
Enter fullscreen mode Exit fullscreen mode

Top comments (0)