30 March, 2018 Tags: , ,

Installing Nim lang on Linux/Ubuntu

Hi there, this is my very first article talking about Nim, the programming language, and on this article I will be talking about the installation process on Linux / Ubuntu using choosenim or the oficial repository using apt-get.



Before we start, I think it’s important we go through a few basic concepts, since Nim and it’s ecosystem is pretty new.

Nim: is a systems and applications programming language. Statically typed and compiled, it provides unparalleled performance in an elegant package.

choosenim: is a tool created by Dominik Picheta  that installs the Nim from official downloads and sources, enabling you to easily switch between stable and development compilers. If you came from Nodejs world, it’s kind of similar to NVM. choosenim basically:

  • Provide an easy way to install Nim and it’s tools.
  • Manage multiple Nim installations.

Installing Nim with choosenim

In order to get the latest version of Nim using choosenim, you just need to type this in your terminal:

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

After this, you will need to add Nim to your setup and environment variable. Open your profile file:

nano ~/.profile

Add this a new variable referencing Nim:

export PATH=/home/YOURUSERNAME/.nimble/bin:$PATH

You can run a test to assure Nim is properly installed:

// Nim's version
nim -v

// The result
Nim Compiler Version 0.18.0 [Linux: amd64]
Copyright (c) 2006-2018 by Andreas Rumpf

git hash: 855956bf617f68ac0be3717329e9e1181e5dc0c6
active boot switches: -d:release

Installing Nim using apt-get

Simple and quick:

sudo apt-get update
sudo apt-get install nim


Installing Nim isn’t a though process whether using choosenim or from the oficial repository using apt-get, although I prefer use choosenim because I can install and manage multiple versions of Nim.