Search code examples
quarkusgraalvmgraalvm-native-image

Problem with Installing/Running GraalVM on Mac


I am using a MacOS Catalina 10.15.7 machine running behind a firewall.

I started evaluating Micronaut and Quarkus as an alternative to Spring boot and one of the main reasons for this is the ability to compile to native image.

To be able to do this I had to install GraalVM. I followed the instructions from here GraalVM Community Edition 20.3.0 and downloaded graalvm-ce-java11-darwin-amd64-20.3.0.tar.gz, I unzipped it in a folder of my choice then exported /Users/myId/work/dev/graalvm/graalvm-ce-java11-20.3.0/Contents/Home/ as GRAALVM_HOME and added GRALLVM_HOME\bin in my path.

After this I went to https://code.quarkus.io/ and uploaded a Hello World Quarkus project to be build with gradle (6.8).

When I run gardle build everything builds OK. When I run gradle quarkusDev the application starts OK and I can hit the Hello World end point.

However when I am trying to build the native image with gradle build -Dquarkus.package.type=native I am getting the below exception

java.lang.RuntimeException: Cannot find the `native-image` in the GRAALVM_HOME, JAVA_HOME and System PATH. Install it using `gu install native-image`

Trying to run gu install native-image results in a window popping up on my screen saying

“graalvm-ce-java11-20.3.0” is damaged and can’t be opened. You should move it to the Bin.

The same error window pops up when I am trying to run the jar build with either gradle build -Dquarkus.package.type=uber-jar or just gradle build

I don't think my GraalVM download is corrupted as the unpacked file looks all right and it seems to have the proper structure.

Any help or hint would be appreciated. Thank you in advance.


Solution

  • In MacOS catalina , you can get around this by executing this:

    xattr -d com.apple.quarantine <PATH TO GRAALVM INSTALLATION>
    

    It's a know issue. More information can be found at the following links:

    https://github.com/oracle/graal/issues/1724

    https://github.com/graalvm/homebrew-tap/issues/6