Create and publish a Kotlin Multiplatform application with Kotlin Toolchain
Kotlin Toolchain is a tool from JetBrains for building, testing, running, and publishing Kotlin projects. It provides a CLI and declarative configuration, so you can work from a terminal, an IDE, or with AI-assisted development tools: The Kotlin Toolchain allows your coding agent go from a new project to a published app with minimal setup and configuration.
The official repository of Kotlin AI skills includes skills dedicated Kotlin Toolchain.
This page guides you through setting up a Kotlin Multiplatform project from scratch using Kotlin Toolchain.
You can also simply ask your agent:
Prerequisites
Install the Kotlin Toolchain CLI
Your agent can install Kotlin Toolchain by itself, but you can also install it manually with the installer script:
The installer script downloads the Kotlin Toolchain CLI, places it in ~/.local/bin, and ensures it's on your PATH. No sudo command is required.
Check that the CLI is available by running kotlin --version.
Building iOS apps
With Kotlin Toolchain, you can handle most of the iOS development workflow, including building, running, and publishing apps directly from the CLI or your IDE, without opening Xcode.
When Xcode is required, Kotlin Toolchain requests installing it and explains how to set it up. The recommended way is to install Xcode from the App Store.
Xcode installation is necessary to provide CLIs for iOS build to Kotlin Toolchain and occasional project-specific workflows.
Create a project
To generate a new project using Kotlin Toolchain:
Navigate to the directory where you'd like Kotlin Toolchain to create your project, for example, Projects.
Run the following command:
kotlin newEnter the directory name when prompted for the project path, for example,
ktc-kmp.In the template list, select Kotlin Multiplatform application.
Use the Space key to select or deselect target platforms. Press Enter to confirm.
Enter a project ID or leave it blank to generate a default ID based on the directory name.
This ID is used across the project to identify the app: in Kotlin package names, the Android namespace and application ID, and the iOS bundle ID.
Confirm installing AI agent configuration: this will create project-specific AGENTS.md with general recommendations and MCP server configurations.
Use the Space key to select your preferred AI agents. Press Enter to confirm.
Kotlin Toolchain generates the project, including configuration files, source code, and wrapper scripts. By default, it also initializes a Git repository.
The resulting project has several *App modules with application entry points for each platform and a shared module with common code. Each module is listed in the overall project.yaml file and configured with its own module.yaml file. Each application module explicitly depends on the shared module. For example for the Android module:
The basic structure of each module follows the KMP source set model, only instead of androidMain, for example, it's src@android.
Run the project
To run the project:
Navigate to the project directory (
ktc-kmpin the example above).Run
kotlin runto bring up the list of available applications to run. The available modules correspond to the target platforms you selected when generating the project:$ kotlin run Multiple modules are available to run, please choose: ❯ desktopApp (with Hot Reload 🔥) androidApp iosApp webAppYou can also run a module directly by using the
-m(--module) option, for example:# Build and run the desktop JVM app kotlin run -m desktopApp
Publish the applications
When you're satisfied with how the app runs, you can publish the applications.
For iOS
Kotlin Toolchain helps you streamline the setup process for publishing to TestFlight. To publish your iOS app, run:
The command starts a wizard with detailed instructions. It guides you through setting up the publishing process with App Store Connect API keys with minimal manual effort. For subsequent releases, publishing works automatically with the same command.
For the manual setup and publishing instructions, see the Kotlin Toolchain documentation.
For Android
To set up and publish your Android app, follow the instructions in the Kotlin Toolchain documentation.
Other target platforms
You can also package a JVM app or a Wasm app, but publishing for these platforms is not fully supported yet.
Work on a project in IntelliJ IDEA or Android Studio
You can work on the project and run it in IntelliJ IDEA or Android Studio.
Install the Kotlin Multiplatform plugin to add IDE support for Kotlin Multiplatform projects as well as support for Kotlin Toolchain project structure and run configurations.
Create a project directly in the IDE
With the Kotlin Multiplatform and Kotlin Toolchain plugins installed, you can also create a new project directly in the IDE:
Open IntelliJ IDEA or Android Studio.
Select File | New | Project.
Select Kotlin Multiplatform and choose Kotlin Toolchain in the Build system switch.
Fill in the rest of the project details and click Create.
When the project is created and imported, the IDE automatically registers run configurations for all declared modules so you can run corresponding applications from the IDE toolbar.
What's next
For more on what Kotlin Toolchain is and what purpose it serves, check out the product FAQ.
A from-scratch tutorial shows how to create a Kotlin Toolchain "Hello, World!" and gradually transform it into a multiplatform project with a complex templated configuration.
For a deep dive into Kotlin Toolchain, check out the user guide.