Installing Nim on Windows
This guide shows several ways to install Nim on Windows: the official method (choosenim) and alternative methods (Scoop/Chocolatey), as well as environment setup, installation verification, and common troubleshooting solutions.
Requirements
- User rights (admin rights may be required for installation via package managers).
- Internet access.
- Terminal: Windows Terminal / PowerShell (recommended) or cmd.
Method 1 (recommended): Installation via choosenim
1) Install choosenim
Open PowerShell and run:
# Download and run the choosenim installer
iwr https://nim-lang.org/choosenim/init.ps1 -useb | iex
If the PowerShell execution policy prevents running scripts, temporarily allow it for the current process:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
iwr https://nim-lang.org/choosenim/init.ps1 -useb | iex
Note: After installation, close and reopen the terminal to refresh the PATH.
2) Install/Update Nim
To install the stable version:
choosenim stable
Check available versions:
choosenim show
Update choosenim and Nim:
choosenim update self
choosenim update stable
3) Verify Installation
nim -v
nimble -v
where.exe nim
where.exe nimble
You should see the version of Nim, the version of Nimble, and the paths to the executables.
Method 2: Installation via Scoop
1) Install Scoop (if not installed)
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
iwr -useb get.scoop.sh | iex
2) Install Nim
scoop install nim
Verification:
nim -v
nimble -v
Method 3: Installation via Chocolatey
Administrator rights and installed Chocolatey are required.
Installation:
choco install nim -y
Verification:
nim -v
nimble -v
Method 4: Manual Installation (if managers are unavailable)
- Download the Nim release for Windows from official sources (Nim releases).
- Extract the archive, for example to:
C:\Tools\Nim\
- Add the folders containing
nim.exeandnimble.exeto PATH (see section below). - Restart the terminal and check:
nim -v nimble -v
Dependencies: C Compiler for Building Nim Projects
Nim compiles code to C/C++, so a toolchain is needed to build most projects.
Option A (recommended): MSVC (Visual Studio Build Tools)
- Install Build Tools for Visual Studio (C++ build tools).
- Ensure the following components are installed:
- MSVC v14x
- Windows SDK
Check in Developer PowerShell for VS:
cl
If cl is available — MSVC is installed.
Option B: MinGW-w64
If you are using MinGW (often convenient in conjunction with Scoop):
scoop install mingw
gcc --version
Setting Up PATH (if commands are not found)
Quick Diagnosis
where.exe nim
where.exe nimble
If nothing is found — PATH does not contain the path to Nim.
Where Nim is Usually Located
Depends on the installation method:
- choosenim: often in the user profile, for example:
%USERPROFILE%\.nimble\bin(for nimble utilities)- Nim directories inside
%USERPROFILE%\.choosenim\...(may vary)
- Scoop:
%USERPROFILE%\scoop\apps\nim\current\bin
- Chocolatey:
C:\ProgramData\chocolatey\bin(often as shim) + package folders
You can clarify the actual paths like this:
# Shows where nim.exe is located (if already present)
where.exe nim
# Path to nimble packages/binaries
nimble path
Adding to PATH via Windows Interface
Win + R→sysdm.cpl→ Advanced tab → Environment Variables.- In User Variables, select Path → Edit.
- Add the path to the folder with
nim.exeand (if necessary)%USERPROFILE%\.nimble\bin. - Click OK and restart the terminal.
Quick Test: Compile and Run a Program
Create a file hello.nim:
echo "Hello from Nim on Windows!"
Compile and run:
nim c -r hello.nim
If everything is set up, you will see the output string in the terminal.
Installing Packages via Nimble
Update the package list:
nimble refresh
Install a package (example):
nimble install winim
Check that Nimble binaries are included in PATH:
# Folder where Nimble stores installed binaries
nimble path
Usually, you need to add to PATH: %USERPROFILE%\.nimble\bin.
Common Issues and Solutions
1) nim/nimble is not recognized as a command
Causes: PATH has not been updated, terminal has not been restarted, installation did not complete.
Solution:
- Restart the terminal.
- Check
where.exe nim. - Add the correct paths to PATH.
2) Compilation/linking errors (no C compiler)
Symptoms: messages about cl.exe/gcc/linker, errors at the CC: stage.
Solution:
- Install MSVC Build Tools (recommended) or MinGW-w64.
- Run the build from an environment where the compiler is available (for example, Developer PowerShell for MSVC).
3) Network loading/installation error (including proxy/antivirus)
Solution:
- Check access to Nim/domains/repositories.
- In a corporate network, configure the proxy for PowerShell and Git (if used).
- Retry the installation after temporarily disabling filtering (if allowed by policies).
4) Related Windows system error 0x8007045D
Code 0x8007045D is usually associated with input/output (I/O) errors when reading/writing. If the Nim installation/downloads are interrupted:
- Try a different disk/folder (for example, not in a network folder).
- Check free space.
- Run a disk check:
chkdsk C: /scan - Download the installer/archive again (the file may be corrupted).
Recommendations for IDEs and Suggestions
For autocompletion and code analysis, nimsuggest is often used (usually installed with Nim).
Popular editors:
- VS Code (extensions for Nim)
- Neovim/Vim/Emacs (via LSP/plugins)
Check:
nimsuggest --version
What Next
- Set up a working project and
.nimblefile (if using Nimble). - Lock the version of Nim for the team/CI (choosenim simplifies version management).
- Add
%USERPROFILE%\.nimble\binto PATH if you are installing CLI utilities via Nimble.