Install GraalVM on macOS

GraalVM is a high-performance virtual machine built by Oracle that can run applications written in JavaScript, Python, Ruby, R, JVM-based languages such as Java, Scala, Kotlin, and LLVM-based languages. like C and C++. Using GraalVM, you do not need to install many different software to program in different languages, just install GraalVM is enough. In this tutorial, I will guide you all how to install GraalVM on macOS.

To install GraalVM, first go to https://www.graalvm.org/downloads/. GraalVM currently has two Community and Enterprise editions, and you can see the differences in the two versions on this download page. Here, I will be using the Community version, so I will go to the https://github.com/graalvm/graalvm-ce-builds/releases/ page to download the GraalVM installation file.

After downloading the GraalVM installation file, unzip this file:

Install GraalVM on macOS

To use GraalVM anywhere on your machine, you need to set the environment variable pointing to the bin directory of the GraalVM directory. But since I currently have a Java version installed on my machine, to avoid touching, I just export a GRAALVM_HOME variable that points to the GraalVM Home folder.

To export the GRAALVM_HOME variable as I said above, I would open the .bash_profile file inside the user directory and add the following line:

Run the following command for our installation to take effect immediately:

If you are using macOS Catalina or later, you need to run the following command to remove the checking software of macOS:

My example is as follows:

OK, now I can check the results.

To check out the Java version that GraalVM has, you can use the following command

Result:

Install GraalVM on macOS

By default, GraalVM only supports Java language, for other languages like NodeJS, Ruby, R, Python, … if you need to use it, let use the gu tool in the bin directory of the GraalVM installation directory to install them. For example, if I need to install NodeJS, I will run the following command:

Result:

Install GraalVM on macOS

Check NodeJS version:

and npm version:

Result:

Install GraalVM on macOS

You can also install Ruby as follows:

Result:

Install GraalVM on macOS

To build Native Images, you can also install the native-image component as follows:

Result:

It is great, isn’t it? 🙂

5 thoughts on “Install GraalVM on macOS

Add Comment