How to install the nim toolset:
This is a guide on how to install the nim compiler and tools on windows. To install nim on linux it is exceedingly easy. Simply type in this command:
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
This will install nim and add it to the path as well as setup mingw which allows the compiler to create windows binaries even on linux.
How to Use Nim on Windows
-
Download and Install
- Download the latest version of the Nim installer from the official website:
- Extract the zip that you downloaded. Then run finish.exe. This installer will guide you through the installation process.
- During the installation process, you will be prompted to choose the components that you want to install. By default, the installer will install the Nim compiler, the Nimble package manager, and the MinGW toolchain, which allows you to compile Nim code for Windows on a Windows system. (just press y for each option and when it asks where to save just save it where it defaults to)
-
After the installation process is complete, the finish.exe program will close.
This means that the Nim compiler and the other components that you chose to install have been installed on your system.
-
Set up Your Environment Variables
- Open the Start menu and search for Environment Variables.
- Click on the Edit the system environment variables option.
- Click on the Environment Variables button.
- Under the System variables section, scroll down until you find the "Path" variable and click on the Edit button.
- Click on the New button and add the path to your Nim installation directory (e.g., C:\nim).
- Click on the OK button to save your changes.
-
Verify Your Nim Installation
- Open a new command prompt window.
- Type the command
and press Enter.nim --version
- If Nim is installed correctly, you should see the version number printed in the command prompt.
-
Write and Run a Nim Program
- Open a text editor such as Notepad or Visual Studio Code.
- Write your Nim program code and save it with a .nim file extension (e.g.,
hello.nim
). - Open a command prompt window and navigate to the directory where your .nim file is saved.
- Type the command
and press Enter. This will compile and run your program.nim c -r hello.nim
- If your program runs successfully, you should see the output printed in the command prompt.