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.
- Navigate to GraalVM Releases repository on GitHub. Depending on the workload, select GraalVM Community Edition based on JDK8 for macOS or GraalVM Community Edition based on JDK11 for macOS and download.
- Extract the archive to your file system:
tar -xvf <graalvm-archive>.tar.gz
Alternatively, open the file in Finder.
- Move the downloaded package to its proper location, the
/Library/Java/JavaVirtualMachines
directory. Since this is a system directory,sudo
is required:sudo mv <graalvm> /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
. - There can be multiple JDKs installed on the machine. The next step is to configure the runtime environment.
- Point the
PATH
environment variable to the GraalVM’sbin
directory:export PATH=/Library/Java/JavaVirtualMachines/<graalvm>/Contents/Home/bin:$PATH
Verify whether you are using GraalVM with
echo $PATH
. - Set the
JAVA_HOME
environment variable to resolve to the GraalVM installation directory:export JAVA_HOME=/Library/Java/JavaVirtualMachines/<graalvm>/Contents/Home
To check whether the installation was successful, enter
java -version
command.
- Point the
Optionally, you can specify GraalVM as the JRE or JDK installation in your Java IDE.
For Oracle GraalVM Enterprise Edition users, find the installation instructions here.
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.3.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 Community Edition for macOS platforms includes the JVM, the GraalVM compiler, the LLVM runtime, and the Node.js JavaScript runtime environment for servers and applications. The base installation can be extended with:
Tools/Utilities:
- Native Image – a technology to compile an application ahead-of-time into a native executable.
- LLVM toolchain – a set of tools and APIs for compiling native programs to bitcode that can be executed with on the GraalVM runtime. Language Runtimes:
- Python – Python 3.8.5 compatible
- Ruby – Ruby 2.6.6 compatible
- R – GNU R 3.6.1 compatible
- Wasm – WebAssembly (Wasm) These functionalities are not part of the GraalVM Community base distribution and must be downloaded and installed separately.
To assist a user with installation, GraalVM includes GraalVM Updater, a command line utility to install and manage additional functionalities. Proceed to the installation steps to add any necessary language runtime or utility from above to GraalVM.