Skip to content

Kotlin Multiplatform keeps a full Kotlin/Native toolchain per version in ~/.konan

Every Kotlin version used in a Multiplatform project downloads its own native compiler and dependencies to ~/.konan. How big it gets and what to remove.

4 min read

Build a Kotlin Multiplatform project for iOS, and Gradle downloads the Kotlin/Native compiler into ~/.konan. Each Kotlin version gets its own copy, plus shared dependencies like the LLVM toolchain. Upgrading Kotlin does not remove the old one.

du -sh ~/.konan
du -sh ~/.konan/* 2>/dev/null | sort -h
du -sh ~/.konan/dependencies 2>/dev/null

What to remove

  • Folders named kotlin-native-prebuilt-macos-... for Kotlin versions your projects no longer use.
  • The cache folders are rebuilt on the next build.
  • The whole ~/.konan can go if you have stopped using Kotlin Multiplatform; it is downloaded again when needed.

Check which version your projects use in gradle/libs.versions.toml or the build file before deleting.

Gradle's own caches: Gradle folder. The bigger picture: Mac storage for Java developers.

Common questions

What is the .konan folder on a Mac?

It is where Kotlin/Native keeps its compiler and dependencies, used when Kotlin Multiplatform builds for iOS or macOS.

Can I delete ~/.konan?

Yes. It is downloaded again on the next Kotlin/Native build. Removing only old versions keeps your current builds fast.

Why is ~/.konan so large?

Each Kotlin version downloads its own native toolchain, and older versions are not removed when you upgrade.

Read next