You can download one of the following pre-built min binaries:
A printable, self-contained guide containing more or less the same content of this web site can be downloaded from here.
Building from source
Alternatively, you can build min from source in one of the following ways:
If you already installed nim, you probably already have the nimble package manager installed.
If that’s the case, simply run nimble install min. This will actually install and run nifty which will download min dependencies for you before compiling.
Without using nimble
- Download and install nim.
- Download and build nifty, and put the nifty executable somewhere in your $PATH.
- Clone the min repository.
- Navigate to the min repository local folder.
- Run nifty install to download min’s dependencies.
- Run nim c -d:release min.nim.
Additional build options
If the -d:ssl flag is specified when compiling, min will be built with SSL support, so it will be possible to:
* perform HTTPS requests with the
* use all the cryptographic symbols defined in the
If this flag is not specified:
- It will not be possible to perform HTTPS requests
Only the following symbols will be exposed by the
Building a Docker image
Yanis Zafirópulos contributed a Dockerfile that you can use to create your own Docker image for min based on Alpine Linux.
To build the image locally, execute the following command from the repository root directory:
docker build -t mindocker .
To run it, execute:
docker run -it mindocker
Running the min Shell
To start the min shell, run min with no arguments. You will be presented with a prompt displaying the path to the current directory:
min shell v$versio [/Users/h3rald/test]$
You can type min code and press ENTER to evaluate it immediately:
[/Users/h3rald/test]$ 2 2 + 4 [/Users/h3rald/test]$
The result of each operation will be placed on top of the stack, and it will be available to subsequent operation
[/Users/h3rald/test]$ dup * 16 [/Users/h3rald/test]$
To exit min shell, press CTRL+C or type 0 exit and press ENTER.
By default, the min shell provides advanced features like tab-completion, history, etc. If however, you run into problems, you can disable these features by running min -j instead, and run min shell with a bare-bones REPL.
Executing a min Program
To execute a min script, you can:
min -e:"... program ..."to execute a program inline.
min myfile.minto execute a program contained in a file.
min also supports running programs from standard input, so the following command can also be used (on Unix-like system) to run a program saved in myfile.min:
$ cat myfile.min | min
You can enable development mode (runtime checks and validations) by spacifying
--dev) when running a min program. If development mode is not enabled, min programs run faster.
Compiling a min Program
min programs can be compiled to a single executable simply by specifying the
--compile) flag when executing a min file:
$ min -c myfile.min
Essentially, this will:
- Generate a myfile.nim containing the equivalent Nim code of your min program.
- Call the Nim compiler to do the rest ;)
If you want to pass any options to the Nim compiler (like
-d:release for example) you can do so by using the
$ min -c myfile.min -n:-d:release
Additionally, you can also use
--module-path) to specify one path containing .min files which will be compiled as well (but not executed) along with the specified file. Whenever a
load or a
require symbol is used to load/require an external .min file, it will attempt to retrieve its contents from the pre-loaded files first before searching the filesystem.
For example, the following command executed in the root folder of the min project will compile run.min along with all .min files included in the tasks folder and its subfolders:
$ min -c run.min -m:tasks
Similarly, you can also bundle additional files in the executable by specifying the
--asset-path) option. At runtime, the compiled min program will attempt to lookup bundled asset files before checking the filesystem.
In order to successfully compile .min files, Nim must be installed on your system and min must be installed via nimble.
- If you are using Visual Studio Code, you can install the official min extension which provides syntax highlighting support, code folding, and auto-indentation.
- If you are using Vim, a min.vim syntax definition file is available in the min repo.
- If you are using Sublime Text 3, Rafael Carrasco created a min syntax definition file that is available here.
- If you are hsing Notepad++, a Notepad++ language file contributed by baykus871 is available in tbe repo.