Skip to content

Configuring the Virtual Machine to Build KMM Apps

Simon B. Støvring edited this page Aug 26, 2024 · 2 revisions

After going through the Configuring the Virtual Machine to Build iOS Apps article, you may follow the steps below to enable the virtual machines to build Kotlin Multiplatform apps, or more specifically, Kotlin Multiplatform Mobile apps.

1. Install Java Runtime

We install OpenJDK's JDK in order to make the Java Runtime available to the system. This can be installed using Homebrew.

brew install openjdk@17

After installing JDK, we need to ensure that the system's Java wrappers can locate it by creating a symlink.

sudo ln -sfn #{opt_libexec}/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

Add the following to ~/.zshrc to ensure JDK is first in the path.

export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"

Add the following to ~/.zshrc to ensure compilers can find JDK.

export CPPFLAGS="-I/opt/homebrew/opt/openjdk@17/include"