Installation on macOS Platforms #

GraalVM Community distributions for macOS are comprised to tar.gz file. Unlike Oracle JDK or OpenJDK distributions for macOS that comes with the .dmg download, GraalVM does not provide the installation wizard.

On the contrary to OpenJDK installations performed only on a systemwide basis, GraalVM environment can be installed for a single user, so administrator privileges are not required. However, if GraalVM is meant to become a default JDK, administrator privileges are required. The JDK installation path is /Library/Java/JavaVirtualMachines/<graalvm>/Contents/Home.

Follow these steps to install GraalVM Community on x86 64-bit macOS operating systems. For Oracle GraalVM Enterprise Edition users, find the installation instructions here.

  1. Navigate to GraalVM Releases repository on GitHub. Depending on the workload, select graalvm-ce-java8-darwin-amd64-20.2.0.tar.gz or graalvm-ce-java11-darwin-amd64-20.2.0.tar.gz and download. We will focus on GraalVM Community based on OpenJDK 8.
  2. Extract the archive to your file system. To extract it in the Downloads directory from the console, type:
    ~/Downloads$ tar -xvf graalvm-ce-java8-darwin-amd64-20.2.0.tar.gz

    Alternatively, open the file in Finder.

  3. Move the obtained GraalVM to its proper location, the /Library/Java/JavaVirtualMachines directory. Since this is a system directory, sudo is required:
    ~/Downloads$ sudo mv graalvm-ce-java8-20.2.0 /Library/Java/JavaVirtualMachines

    To verify if the move is successful and to get a list of all installed JDKs, run /usr/libexec/java_home -V.

  4. Since there can be multiple JDKs installed on the machine, the next step is to configure the runtime environment.
    • Add the GraalVM bin folder to the PATH environment variable:
        $ export PATH=/Library/Java/JavaVirtualMachines/graalvm-ce-java8-20.2.0/Contents/Home/bin:$PATH

      Verify whether you are using GraalVM with the echo command: $ echo $PATH.

    • Set the JAVA_HOME environment variable to resolve to the GraalVM installation directory: $ export JAVA_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java8-20.2.0/Contents/Home. Please also see the notice on java_home command.
        $ export JAVA_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java8-20.2.0/Contents/Home

      Please also see the notice on java_home below.

  5. You can specify GraalVM as the JRE or JDK installation in your Java IDE.

Note on macOS java_home command The information property file, Info.plist, is in the top level Contents folder. This means that GraalVM participates in the macOS specific /usr/libexec/java_home mechanism. Depending on other JDK installation(s) available, it is now possible that /usr/libexec/java_home -v1.8 returns /Library/Java/JavaVirtualMachines/graalvm-ce-java8-20.2.0/Contents/Home. You can run /usr/libexec/java_home -v1.8 -V to see the complete list of 1.8 JVMs available to the java_home command. This command appears to sort the JVMs in decreasing version order and chooses the top one as the default for the specified version. Within a specific version, the sort order appears to be stable but is unspecified.

Install Additional Components #

The base distribution of GraalVM for macOS platforms includes the JVM, the GraalVM compiler, the LLVM bitcode interpreter, and the JavaScript runtime with Node.js support. GraalVM environment can be extended with additional components.

To add support for Python, R, Ruby or WebAssembly languages interpreters in GraalVM Community Edition, use of the functional gu utility. There is a component catalog on GitHub maintained by Oracle (gu available), from which you can install a component just by its name:

gu install ruby
gu install r
gu install python
gu install wasm

To install GraalVM Native Image, run:

gu install native-image

To install the LLVM toolchain component, run:

gu install llvm-toolchain

Additional components may be also installed from the local components collection. For more details, proceed to the GraaVM Updater page.