Hello, dear readers. Today, you will learn how to install the Nim programming language on Debian 11.
Nim is a programming language that has been inspired by Delphi. Therefore, it is a compiled language that focuses on efficiency, ease of reading source code and flexibility.
Nim combines successful concepts from mature languages like Python, Ada and Modula. In addition to this, it is open source, so we can examine its source code.
We could say that Nim is a new language that promises to incorporate improvements and alternatives to what already exists. For example, it can be integrated for backend functions with Python, C and others.
Another thing that favors Nim is that the installation process is simple. So let’s go for it.
Installing the Nim programming language in Debian 11
The development of the language advances constantly, and it is already present in the Debian repositories. Therefore, you just have to open a terminal and run
sudo apt install nim
This way the compiler will already be installed.
However, before I said that the development of Nim advances and although the previous command is simple and effective, it does not provide us with the latest stable version.
For this, then it is better to use the installation script provided by the developers.
First, install all the packages needed to compile and build packages.
sudo apt install build-essential
Then, download and run the language installation script.
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
During the process, you will see a question about sending data anonymously to the developers to contribute to the development. This is optional, and you can answer
N as you wish.
Then the process will continue and at the end you will notice that you are asked to edit the
~/.profile file to add the Nim installation directory to the PATH.
So edit the file
And at the end of the file, add the following line.
Don’t forget that you have to replace
angelo with the name of your user.
Thereafter, apply the changes by running
Finally, you will be able to verify the use of the
So, Nim is installed and working properly.
Creating our first program with the Nim programming language in Debian 11.
The best way to test Nim is to create a small program. So, we will make a “Hello World”.
Create the source file
And add the following
echo "Hi, welcome to unixcop.com"
Save the changes and close the editor.
Compile the file using this command
nim c example.nim
Now run it:
So, Nim is ready, and you can use it now.
Thanks to this post, you learned how to install Nim. This modern programming language aims to give us a flexible alternative to the most popular languages.