How To Install Kotlin Compiler on Debian 13

Install Kotlin Compiler on Debian 13

If you are a developer or sysadmin running Debian 13 (Trixie) and you want to start writing Kotlin code directly from the terminal, you are in the right place. Kotlin has grown far beyond Android development — it now powers backend services, scripting, and cross-platform projects, and many Linux developers prefer to work with it from the command line. The problem is that Debian 13 does not ship a Kotlin compiler through its default APT repositories, which means you need to set it up manually. This guide walks you through exactly how to install Kotlin Compiler on Debian 13 using three reliable methods, so you can choose the one that best fits your workflow.

Debian 13, codenamed “Trixie,” was officially released on August 9, 2025. It ships with Linux Kernel 6.12, APT 3.0 with the new Solver3 dependency engine, and significantly improved developer tooling support compared to Debian 12 Bookworm. These improvements make Trixie one of the cleanest Debian releases to work with for setting up development environments.

By the end of this guide, you will have a fully working Kotlin compiler installed, your PATH configured correctly, and a compiled Kotlin program running on your machine. Whether you are brand new to Kotlin on Linux or just need a refresher for the Trixie release, this tutorial has you covered.

What Is the Kotlin Compiler and Why Do You Need It on Debian 13

Kotlin is a statically typed programming language developed by JetBrains. It runs on the Java Virtual Machine (JVM), which means it compiles down to JVM bytecode and can interoperate fully with Java code and libraries.

The Kotlin compiler, called kotlinc, is the command-line tool that turns your .kt source files into .class files or self-contained .jar archives. Without it, you cannot compile or run Kotlin programs outside of an IDE like IntelliJ IDEA.

On Debian 13, the Kotlin package was dropped from the official APT repository. This means you cannot run apt install kotlin and expect it to work. You need to install the compiler yourself through one of the three methods covered in this guide: SDKMAN (recommended), manual binary installation from GitHub, or Snap.

Understanding this distinction matters because it shapes how you manage updates and handle version switching. A sysadmin managing multiple projects, for example, will benefit far more from SDKMAN’s multi-version support than from a static manual installation.

What kotlinc Can Do

  • Compile .kt files to JVM bytecode (.class files)
  • Package output as a runnable .jar with the -include-runtime flag
  • Run Kotlin scripts (.kts files) directly with the -script option
  • Launch an interactive REPL session using -Xrepl
  • Compile shared libraries without bundling the runtime for use in other Kotlin projects

Prerequisites

Before you begin, make sure your system meets the following requirements:

  • Operating system: Debian 13 (Trixie) — verify with lsb_release -a
  • User privileges: A non-root sudo user or direct root access
  • Internet connection: Required for downloading packages and binaries
  • Disk space: At least 500 MB free for JDK and Kotlin binaries
  • Shell: Bash or Zsh (both are fully supported by SDKMAN and Kotlin’s PATH setup)
  • Required tools: curl, zip, unzip (needed for the SDKMAN installation method — instructions included below)

If you are using a fresh Debian 13 install, some of these tools may not be present yet. The steps below cover installing everything you need from scratch.

Step 1: Update Your Debian 13 System

The first thing you should do before installing any new software is bring your system fully up to date. This ensures APT 3.0’s Solver3 engine resolves all dependency chains correctly and prevents conflicts during installation.

Run the following commands:

sudo apt update
sudo apt upgrade -y

The apt update command syncs your local package index with the remote repositories. The apt upgrade -y command installs all available updates without prompting for confirmation.

After the upgrade completes, verify there are no held-back packages:

apt list --upgradable

If the output is empty, your system is fully up to date and ready to proceed.

Step 2: Install the Java Development Kit (JDK)

Kotlin compiles to JVM bytecode, which means it depends entirely on a working Java Development Kit (JDK) being present on your system. Without JDK, the Kotlin compiler will not run at all.

Install the default JDK package for Debian 13:

sudo apt install default-jdk -y

This installs OpenJDK, which is the standard JDK shipped with Debian. It includes both the Java Runtime Environment (JRE) and the Java compiler (javac).

Verify the JDK Installation

java -version
javac -version

You should see output similar to:

openjdk version "21.x.x" ...
javac 21.x.x

Configure JAVA_HOME

Many tools, including SDKMAN and Gradle, rely on the JAVA_HOME environment variable being set. Add it to your shell profile:

echo 'export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))' >> ~/.bashrc
echo 'export PATH=$JAVA_HOME/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

Confirm the variable is set correctly:

echo $JAVA_HOME

The output should show a path like /usr/lib/jvm/java-21-openjdk-amd64. If you need a specific JDK version for a project, you can install it explicitly with sudo apt install openjdk-21-jdk -y.

Step 3: Install Kotlin Compiler Using SDKMAN (Recommended Method)

SDKMAN (Software Development Kit Manager) is the officially recommended way to install Kotlin on Linux systems, as documented by JetBrains. It manages multiple SDK versions side by side, automates PATH setup, and works in both Bash and Zsh shells. For most developers and sysadmins setting up a Kotlin development environment on Debian 13, this is the cleanest approach.

Install SDKMAN Dependencies

SDKMAN’s installer script requires curl, zip, and unzip. Install them first:

sudo apt install curl zip unzip -y

Install SDKMAN

Run the official SDKMAN install script:

curl -s "https://get.sdkman.io" | bash

This downloads and installs SDKMAN to ~/.sdkman/ in your home directory, keeping it fully user-scoped and separate from system packages.

Once the script finishes, initialize SDKMAN in your current shell session:

source "$HOME/.sdkman/bin/sdkman-init.sh"

Verify that SDKMAN installed correctly:

sdk version

You should see output showing the SDKMAN version number. If you see sdk: command not found, close and reopen your terminal, then run the source command again.

Install Kotlin via SDKMAN

With SDKMAN active, installing Kotlin is a single command:

sdk install kotlin

SDKMAN automatically downloads the latest stable release of the Kotlin compiler and configures your PATH. When the installation finishes, you will see a confirmation message showing the installed version.

To install a specific Kotlin version instead:

sdk install kotlin 2.0.21

To list all available Kotlin versions:

sdk list kotlin

Switch Between Kotlin Versions

One of SDKMAN’s strongest features for sysadmins managing multiple projects is version switching. If one project requires Kotlin 1.9.x and another requires 2.x, you can switch without reinstalling anything.

Switch the active version for your current shell session:

sdk use kotlin 1.9.22

To lock a specific Kotlin version for a project, create a .sdkmanrc file in the project root:

sdk env init

This creates the file automatically. SDKMAN reads it when you cd into that directory, provided you have sdkman_auto_env=true in your ~/.sdkman/etc/config.

Step 4: Install Kotlin Compiler Manually (GitHub Binary Method)

The manual installation method works best for CI/CD pipelines, offline environments, or system-wide installations where all users on the machine need access to the same Kotlin compiler binary.

Download the Kotlin Compiler ZIP

Visit the JetBrains Kotlin GitHub Releases page to identify the latest stable version, then download it with wget. Replace 2.x.x with the actual current version number:

wget https://github.com/JetBrains/kotlin/releases/download/v2.x.x/kotlin-compiler-2.x.x.zip

Extract and Move the Binaries

Unzip the downloaded archive:

unzip kotlin-compiler-2.x.x.zip

Move the binaries to a system-wide location so all users can access them:

sudo mv kotlinc /usr/local/

Clean up the downloaded files:

rm kotlin-compiler-2.x.x.zip

Configure PATH for Manual Installation

Open your ~/.bashrc file:

nano ~/.bashrc

Add the following lines at the bottom:

export KOTLIN_HOME=/usr/local/kotlinc
export PATH=$PATH:$KOTLIN_HOME/bin

Save the file and apply the changes:

source ~/.bashrc

Verify the PATH update worked:

echo $PATH | grep kotlin

You should see /usr/local/kotlinc/bin in the output. If the path is missing, double-check that you saved ~/.bashrc correctly and re-run source ~/.bashrc.

Step 5: Install Kotlin Compiler via Snap

Snap is a universal Linux package format. The official Kotlin snap is published on the Snap Store and provides a straightforward installation path for users who prefer snap-based package management.

Install Snapd on Debian 13

Snapd is not installed by default on Debian 13. Set it up first:

sudo apt update
sudo apt install snapd -y
sudo snap install snapd

After the installation completes, either reboot your system or log out and back in. This step is necessary to fully initialize the snap daemon and socket connections.

Install Kotlin via Snap

sudo snap install --classic kotlin

The --classic flag is required because Kotlin needs access to system-level JDK resources that exist outside the snap sandbox. Without this flag, the installation will fail or the compiler will not function correctly.

Once the installation finishes, the kotlinc command is available system-wide immediately.

Step 6: Verify the Kotlin Compiler Installation and Compile Your First Program

After completing any of the three installation methods above, verify that everything is working before writing real code.

Verify the Compiler

kotlinc -version

Expected output:

kotlinc-jvm 2.x.x (JRE 21.x.x)

Check that the compiler binary is accessible from any directory:

which kotlinc

Run the help flag to confirm the compiler responds and list all available options:

kotlinc -help

Write Your First Kotlin Program

Create a new file called hello.kt:

nano hello.kt

Add the following code:

fun main() {
    println("Hello, Debian 13 Trixie!")
}

Save and exit the file (Ctrl+X, then Y, then Enter).

Compile the Program

kotlinc hello.kt -include-runtime -d hello.jar

Here is what each flag does:

  • hello.kt — the Kotlin source file to compile
  • -include-runtime — bundles the Kotlin runtime library inside the JAR so it runs standalone without needing Kotlin installed on the target machine
  • -d hello.jar — specifies the output file name

Compilation may take a few seconds on the first run because the compiler loads the JVM. This is normal behavior.

Run the Compiled Program

java -jar hello.jar

Expected output:

Hello, Debian 13 Trixie!

If you see this output, your full Kotlin compiler pipeline is working correctly: .kt source file compiled by kotlinc, packaged as a .jar, and executed by the Java runtime.

Kotlin Compiler on Debian 13 Setup: Choosing the Right Method

Different use cases call for different installation methods. Here is a practical breakdown to help you decide:

Feature SDKMAN Manual (GitHub) Snap
Ease of install High Medium High
Multi-version support Yes No No
System-wide access No (user-scoped) Yes Yes
Works offline No Yes No
Auto PATH setup Yes No Yes
Best for Most developers CI/CD, offline, servers Quick desktop setups

For the majority of developers and sysadmins doing day-to-day Kotlin work on Debian 13, SDKMAN is the right choice. It handles version management automatically, keeps your home directory clean, and integrates well with tools like Gradle and Maven.

The manual method is better suited for server environments where you want a single system-wide binary available to all users, or for automated deployment pipelines that do not have outbound internet access at runtime.

Snap is the fastest option for a one-time desktop install where version management is not a concern.

Troubleshooting Common Issues

Error: kotlinc: command not found

Cause: The PATH was not updated after installation, or the shell session was not refreshed.

Fix (SDKMAN):

source "$HOME/.sdkman/bin/sdkman-init.sh"

Fix (Manual):

source ~/.bashrc

Close and reopen the terminal if the above commands do not resolve it.

Error: java: command not found or JVM-related errors during compilation

Cause: JDK is either not installed or JAVA_HOME is not set correctly.

Fix:

sudo apt install default-jdk -y
export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
source ~/.bashrc

Error: Snap install fails or kotlin command not found after Snap install

Cause: Snapd was not fully initialized after the first install.

Fix: Reboot the system or restart the snap service:

sudo systemctl restart snapd

Then re-run:

sudo snap install --classic kotlin

Error: sdk: command not found after SDKMAN install

Cause: The shell profile was not sourced after SDKMAN was installed.

Fix:

source "$HOME/.sdkman/bin/sdkman-init.sh"

To make this permanent, add that line to the bottom of your ~/.bashrc or ~/.zshrc file.

Issue: An Outdated Kotlin Version Is Installed

Fix (SDKMAN):

sdk upgrade kotlin

Fix (Manual): Download the latest ZIP from the JetBrains GitHub Releases page, extract it, and overwrite the existing binaries in /usr/local/kotlinc/bin/.

Fix (Snap):

sudo snap refresh kotlin

How To Keep the Kotlin Compiler Up to Date on Debian 13

Staying current with Kotlin releases matters because JetBrains regularly ships compiler improvements, performance fixes, and language feature updates.

  • SDKMAN users: Run sdk upgrade kotlin periodically. SDKMAN checks for the latest stable release and upgrades cleanly without breaking your existing environment.
  • Manual users: Watch the JetBrains Kotlin GitHub Releases page for new versions. When a new version drops, download the ZIP, extract it, and overwrite the binaries in /usr/local/kotlinc/bin/.
  • Snap users: Snap packages auto-update in the background by default. To force an immediate update, run sudo snap refresh kotlin.

Subscribing to JetBrains’ Kotlin blog or enabling GitHub Release notifications for the Kotlin repository is a practical habit for staying ahead of major version changes.

Congratulations! You have successfully installed Kotlin Compiler. Thanks for using this tutorial for installing Kotlin Compiler programming language on your Debian 13 “Trixie” system. For additional help or useful information, we recommend you check the official Kotlin website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!
r00t is a dedicated and highly skilled Linux Systems Administrator with over a decade of progressive experience in designing, deploying, and maintaining enterprise-grade Linux infrastructure. His professional journey began in the telecommunications industry, where early exposure to Unix-based operating systems ignited a deep and enduring passion for open-source technologies and server administration.​ Throughout his career, r00t has demonstrated exceptional proficiency in managing large-scale Linux environments, overseeing more than 300 servers across development, staging, and production platforms while consistently achieving 99.9% system uptime. He holds advanced competencies in Red Hat Enterprise Linux (RHEL), Debian, and Ubuntu distributions, complemented by hands-on expertise in automation tools such as Ansible, Terraform, Bash scripting, and Python.

Related Posts