MyNim is a tool to install and manage various versions of Nim and related tools.
Since it requires a bash and symlinks, it works fine on Unix derived systems (e.g. MacOSX or Linux) but not on Windows.
Just download the mynim
file, make it executable and put it somewhere on your $PATH.
Then, add the folders ~/.mynim/bin
and ~/.nimble/bin
to your $PATH. The first one
contains the binaries for nim
and related tools, such as the nimble
package manager.
The second one contains binaries installed using Nimble.
For instance, I use ~/.bin
as a generic directory where to put local executables.
With this convention you can download mynim
from this Gist, and then make it executable
with the following commands:
mkdir -p ~/.bin
mv mynim ~/.bin
chmod +x ~/.bin/mynim
Then, edit your .bash_profile
(on MacOSX) or .bashrc
(on Linux) file and add something
like the following lines:
BIN="$HOME/.bin"
MYNIM="$HOME/.mynim/bin"
NIMBLE="$HOME/.nimble/bin"
PATH="$BIN:$MYNIM:$NIMBLE:$PATH"
New shells will automatically take these settings, but you can refresh them now with
source ~/.bash_profile
or source ~/.bashrc
respectively.
If you have installed MyNim following the previous commands, you should be able to
launch the mynim
command. By default it displays a help like
mynim
Manage nim versions
Usage:
$ mynim install VERSION
$ mynim uninstall VERSION
$ mynim use VERSION
$ mynim list
$ mynim active
$ mynim update
You can install a version of Nim with mynim install
, then switch to using it with
mynim use
. For instance, to install v0.19.4
(the latest stable version at the moment
of writing), just run
mynim install v0.19.4
mynim use v0.19.4
To install the development version of Nim, use
mynim install devel
Multiple versions can coexist, and you can switch between them with mynim use $VERSION
.
If you are on devel, you can keep up with the latest development by mynim update
.