Getting GraalVM to work on MacOS Big Sur

If you're trying to run GraalVM on MacOS Big Sur it is likely you've seen an error message that tells you that it is damaged. I ran into this today and luckily stumbled across the Github issue that contains the fix.

To install and get everything running properly do the following:

Then move GraalVM into your virtual machines directory:

sudo mv graalvm-ce-java11-20.3.0/ /Library/Java/JavaVirtualMachines/

Add the necessary GraalVM environment variables (change 20.3.0 to your version if it is different):

export PATH=/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.3.0/Contents/Home/bin:"$PATH"
export JAVA_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.3.0/Contents/Home

At this point if you try to run a command like gu you'll probably get the error message about the download being broken. When that happens you can do this:

sudo xattr -r -d /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.3.0/

Try running gu again and you should be all set.