Getting ready for developing iOS apps in Kotlin Multiplatform on MacOS.

Before starting lets make sure that we have the KMP plugin Installed in Android Studio.
https://plugins.jetbrains.com/plugin/14936-kotlin-multiplatform/versions/dev
Installing Xcode
- Download Xcode:
- Xcode can be downloaded from the Mac App Store. Simply search for “Xcode” and click “Get” to install. Make sure you select to develop on iOS devices at the start.
- Install Xcode:
- After downloading, Xcode will automatically install. You can find it in your
/Applications
directory.
Configuring Command Line Tools (Can’t find Xcode installed error)
Once Xcode is installed, you need to configure the command line tools to ensure that build scripts and terminal commands can utilize Xcode’s build tools, compilers, and other utilities.
- Open Xcode:
- Navigate to your Applications folder and double-click on Xcode to open it.
2. Access Preferences:
- In Xcode, go to the menu bar at the top of the screen, select “Xcode,” and then choose “Preferences” from the dropdown menu.
3. Navigate to the Locations Tab:
- In the Preferences window, click on the “Locations” tab to view various settings related to Xcode installations and locations of supporting files.
4. Set the Command Line Tools:
- In the “Locations” panel, you’ll see an option for “Command Line Tools” (as shown in your screenshot). Use the dropdown menu to select the version of Xcode you wish to use for command line tools. This should typically be the latest version installed, such as Xcode 15.4.

Developing with Kotlin Multiplatform applications often requires switching between different Java versions to ensure compatibility across new and existing projects. With macOS, you can manage multiple Java versions efficiently using Homebrew and set up your environment to switch between them seamlessly. This guide will walk you through the process of installing and configuring multiple Java versions for your Kotlin Multiplatform projects.
Before you begin, ensure you have Homebrew installed on your macOS. If not, you can install it by running the following command in your terminal:
`/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Installing Multiple Java Versions
To manage Java versions efficiently, we’ll use the Adoptium Temurin OpenJDK builds, which are available through Homebrew.
1. Remove any previous AdoptOpenJDK taps (if applicable):
brew untap AdoptOpenJDK/openjdk
2. Install the Temurin versions:
brew install --cask temurin # This installs the latest LTS version
brew tap homebrew/cask-versions
brew install --cask temurin@8
brew install --cask temurin@11
brew install --cask temurin@17
brew install --cask temurin@18
brew install --cask temurin@19
brew install --cask temurin@21
Configuring Your Shell for Java Version Switching
To switch between different Java versions, you need to configure your shell’s profile file (.bash_profile
for Bash or .zshrc
for Zsh). This setup involves defining environment variables and aliases for each Java version.
- Open your profile file:
# For Bash
nano ~/.bash_profile
# For Zsh
nano ~/.zshrc
2. Add the following configuration to your profile file:
# Java Home Paths
export JAVA_8_HOME=$(/usr/libexec/java_home -v1.8)
export JAVA_11_HOME=$(/usr/libexec/java_home -v11)
export JAVA_17_HOME=$(/usr/libexec/java_home -v17)
export JAVA_18_HOME=$(/usr/libexec/java_home -v18)
export JAVA_19_HOME=$(/usr/libexec/java_home -v19)
export JAVA_21_HOME=$(/usr/libexec/java_home -v21)
# Aliases for switching Java versions
alias java8='export JAVA_HOME=$JAVA_8_HOME'
alias java11='export JAVA_HOME=$JAVA_11_HOME'
alias java17='export JAVA_HOME=$JAVA_17_HOME'
alias java18='export JAVA_HOME=$JAVA_18_HOME'
alias java19='export JAVA_HOME=$JAVA_19_HOME'
alias java21='export JAVA_HOME=$JAVA_21_HOME'
# Set default Java version I am setting mine to use java 11 to build my KMM App
java11
3. Apply the changes:
# For Bash
source ~/.bash_profile
# For Zsh
source ~/.zshrc
Switching Between Java Versions
With the configuration above, you can easily switch between different Java versions by using the aliases defined. For example:
java18
Running the iOS application on the Apple simulator.
1. Open android studio select your build your iOS app your configuration should look something like this.

Conclusion
For Kotlin Multiplatform development, having the correct setup ensures that your build scripts can execute without issues, particularly when dealing with iOS targets or when you need to perform tasks that require native macOS compatibility.
This setup not only streamlines your development process but also ensures that all components of your project can be built using a consistent environment, reducing the likelihood of encountering build-related errors. By following this guide, you can streamline your development workflow and focus on building great applications.
Feel free to share your thoughts and experiences in the comments below, and happy coding!