Install Nim on Unix

Installation using choosenim

choosenim is an installer for the Nim programming language. It allows you to easily switch between versions of Nim, whether that is the latest stable release or the latest development version.

To install the latest stable release of Nim using choosenim, just run the following in your terminal, then follow the onscreen instructions:

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

Manual installation

Pre-built binaries for Linux

If you’re not sure which version (64-bit or 32-bit) to pick, it is very likely that you want the 64-bit version (x86_64):

Download x86_64 tarball SHA256

If you know what you’re doing and you’re sure you need a 32-bit version, you can download it below:

Download x86 tarball SHA256

Source archive

Download source tarball SHA256

After downloading the compressed archive, extract its contents into the desired installation directory. Pre-built binaries are provided in the binary distribution.

For the source distribution, open a new terminal window, cd into the extracted directory, and execute the following commands:

sh build.sh
bin/nim c koch
./koch boot -d:release
./koch tools

Configuring the PATH environment variable for a manual installation

The compiler and tool binaries live inside the bin directory. It is common for Nim developers to include two directories in their PATH environment variable:

Notes about compiler dependencies

The Nim compiler needs a C compiler in order to compile software. You must install this separately and ensure that it is in your PATH.

macOS

Simply install the latest version of clang available on your system. You can do this by:

Source: Quora

Linux

You probably already have a compiler installed. If not, use your package manager to install either gcc or clang.

Other dependencies

There are a number of other dependencies that you may need to install in order to use Nim. They include:

You can use your package manager to install these dependencies when necessary.

Installation using package managers

Arch Linux

pacman -S nim

Debian / Ubuntu

apt-get install nim

Docker

The community managed Docker images are published on Docker Hub and include the compiler and Nimble. There are images for standalone scripts as well as Nimble packages.

Get the latest stable image:

docker pull nimlang/nim

The latest development version:

docker pull nimlang/nim:devel

FreeBSD

pkg install nim

macOS

brew install nim

OpenBSD

pkg_add nim

openSUSE

zypper in nim

Void Linux

xbps-install -S nim