How to install GraalVM on Mac

Install GraalVM with Homebrew

Homebrew is the preferred way to install anything on your Mac.

brew install graalvm/tap/graalvm-ce-java17
Code language: Bash (bash)

Install GraalVM without Homebrew

Follow these 5 steps to get GraalVM installed on your Mac.

Step1:

Download the official binary: https://www.graalvm.org/downloads/

Unpack the archive into a folder.

Step2:

Move the folder into the JavaVirtualMachines directory:

sudo mv graalvm-ce-java17-21.3.0 /Library/Java/JavaVirtualMachines
Code language: Bash (bash)

sudo is required because /Library is a system directory.

Step3:

Verify the installation using the java_home utility:

/usr/libexec/java_home -V

This now needs to be added to the PATH, but first let’s make sure we can reference the new location:

/usr/libexec/java_home -v 1.17
Code language: Bash (bash)

..should print out the newly created entry’s absolute directory path as above:

/Library/Java/JavaVirtualMachines/graalvm-ce-java17-21.3.0/Contents/Home

Open you ~/.bash_profile and add:

export JAVA_HOME=$(/usr/libexec/java_home -v 1.17) export PATH=$JAVA_HOME/bin:$PATH
Code language: Bash (bash)

Step4:

Now to complete the installation, simply run the following:

gu install native-image
Code language: Bash (bash)

This binary is located at /Library/Java/JavaVirtualMachines/graalvm-ce-<version>/Contents/Home/bin if it’s not immediately available.

Step5:

native-image will now be added to the path.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments