Building native images requires GraalVM. The instructions below use SDKMAN! to manage JDK installations — not mandatory, but recommended, as it makes switching JDKs during development easy.
Check the Quarkus documentation
for the currently supported GraalVM version, and use it in place of
<graalvm-version> below.
-
Install SDKMAN!:
curl -s "https://get.sdkman.io" | bash
-
Install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Install GraalVM with Homebrew:
brew install --cask graalvm/tap/<graalvm-version>
-
Register the GraalVM installation with SDKMAN!:
sdk install java <graalvm-version>-grl /Library/Java/JavaVirtualMachines/<graalvm-version>/Contents/Home
-
In the module you want to build, switch to GraalVM and run the native build:
sdk use java <graalvm-version>-grl mvn clean package -Pnative