Linux

Installing Nim on Debian: A Complete Guide for Developers

In this guide, you'll install the modern compiled programming language Nim on your Debian system. You'll get a ready-to-use development environment for high-performance applications with C-like speed and Python-like syntax.

Updated at February 15, 2026
10-15 minutes
Easy
FixPedia Team
Применимо к:Debian 11 (Bullseye)Debian 12 (Bookworm)Debian Testing

Introduction / Why This Is Needed

Nim is a statically typed compiled language that combines Python's expressiveness with C's performance. Installing Nim on Debian opens up opportunities for developing system software, embedded applications, games, and high-load servers. After completing this guide, you will have a fully configured environment for compiling and running Nim code.

Requirements / Preparation

Before you begin, ensure that:

  • You have a 64-bit Debian 11 (Bullseye) or newer system.
  • You have access to an account with sudo privileges to install system packages.
  • The terminal is connected to the internet for downloading files.

Mandatory System Packages

Open a terminal and install the build tools:

sudo apt update
sudo apt install -y build-essential curl git
  • build-essential — provides gcc, make, and other basic compilation utilities.
  • curl — for downloading the installation script.
  • git — recommended for working with dependencies via Nimble.

Step-by-Step Guide

Step 1: Installing choosenim

The official and recommended way to install Nim is through the version manager choosenim. It automatically downloads and manages multiple versions of the compiler.

Run in the terminal:

curl https://nim-lang.org/choosenim/init.sh -sSf | sh

The script will ask if you want to add Nim to your PATH. Answer y (yes).

Step 2: Configuring the PATH Environment Variable

After installation, choosenim adds the path to the binaries in the ~/.profile file. To apply the changes in the current terminal session, run:

source ~/.profile

Or simply close and reopen the terminal.

Step 3: Installing the Selected Nim Version

Now that choosenim is installed, use it to install the latest stable version of Nim:

choosenim stable

The process will take several minutes as the compiler sources are downloaded and compiled. At the end, you will see a success message.

Step 4: Verifying the Installation

Ensure the compiler is available and working:

nim --version

The output should look something like:

Nim Compiler Version 2.0.0 [Linux: amd64]
Compiled at 2026-02-10
...

Also check that the Nimble package manager is working:

nimble --version

Step 5: Creating and Running a Test Project

Let's create a simple project to ensure everything works end-to-end.

  1. Create a new directory and navigate to it:
    mkdir ~/nim_test && cd ~/nim_test
    
  2. Create a file hello.nim with the content:
    echo("Привет, мир Nim на Debian!")
    
  3. Compile and run it with a single command:
    nim r hello.nim
    
    You should see the output: Привет, мир Nim на Debian!

Verifying the Result

A successful installation is confirmed by meeting the following conditions:

  1. The nim --version command does not return a "command not found" error.
  2. The compiler version matches the latest stable (e.g., 2.0.x).
  3. The newly created test script successfully compiled and executed.

Potential Issues

Error: nim: command not found

Cause: The path to Nim's executables is not added to the PATH variable. Solution: Ensure you ran source ~/.profile or added export PATH="$HOME/.nimble/bin:$PATH" to the end of ~/.bashrc (or ~/.zshrc for Zsh) and restarted the terminal.

Compilation Error: cc: command not found or make: not found

Cause: The build-essential packages are not installed. Solution: Install them as shown in the Requirements section: sudo apt install build-essential.

choosenim Cannot Download Files (Timeout/SSL Error)

Cause: Issues with network connection or outdated root certificates. Solution: Ensure the system has internet access. Try updating ca-certificates: sudo apt install ca-certificates. If the problem persists, you can manually download the archive from the official website and unpack it into ~/.nimble.

Although the Debian repositories contain a nim package (sudo apt install nim), it almost always contains a heavily outdated version. Use this method only if you critically need the repository version for compatibility, and be prepared for manual updates. For development, always choose choosenim.

F.A.Q.

Can Nim be installed from the official Debian repositories?
What to do if the `nim` command is not found after installation?
Are additional dependencies needed to build Nim projects?

Hints

Updating package list and installing dependencies
Downloading and running the choosenim script
Configuring the PATH environment variable
Verifying successful installation
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community