Skip to content

Instantly share code, notes, and snippets.

@yashpatil
Last active May 20, 2020 09:28
Show Gist options
  • Save yashpatil/7f377f2251e30bb24a0df8b9be402507 to your computer and use it in GitHub Desktop.
Save yashpatil/7f377f2251e30bb24a0df8b9be402507 to your computer and use it in GitHub Desktop.

Download specific version

Download a specific version from the Releases page (https://github.com/graalvm/graalvm-ce-builds/releases). Note you should not take the latest by default, as Quarkus does not always support the latest version.

Move to JVM directory

Unzip and move to JVM directory sudo mv ~/Downloads/graalvm-ce-java8-20.0.0 /Library/Java/JavaVirtualMachines

Check installed JVMs

/usr/libexec/java_home -V # note the uppercase V Sample output:

Matching Java Virtual Machines (4):
    11.0.6, x86_64:	"GraalVM CE 20.0.0"	/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.0.0/Contents/Home
    1.8.0_241, x86_64:	"GraalVM CE 20.0.0"	/Library/Java/JavaVirtualMachines/graalvm-ce-java8-20.0.0/Contents/Home
    1.8.0_231, x86_64:	"GraalVM CE 19.2.1"	/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home
    1.8.0_202, x86_64:	"AdoptOpenJDK 8"	/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home

Set default JVM

/usr/libexec/java_home -v 1.8.0_241 # note the lowercase v, 1.8.0_241 is the label for the JVM from the command above.

Check JVM

run java -version to see if the default JVM has been set up. If you get a MacOS security warning, run the next step, otherwise skip it.

Allow GraalVM to be executable

GraalVM is currently not notarized for MacOS and needs to be removed from quarantine using the following command: xattr -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-ce-java8-20.0.0

Add to path

Add the JVM to your path.

export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java8-20.0.0/Contents/Home
export PATH=$GRAALVM_HOME:$PATH

Install native image

Run the command below to install the native image (used for building native images of your Quarkus apps): /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.0.0/Contents/Home/bin/gu install native-image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment