How to install SCaml compiler.

Linux and Mac OS X

SCaml is developed and tested on Linux and Mac OS X. Other Unicies may work too, but at your own risk.

From source or Docker?

2 ways of installation:

Install a Docker image
The easier way to try SCaml.
Build from source
Build your own program is always the best, especially when you want to try dev versions.

Install a Docker image

Install Docker

Install Docker. Some remarks for typical environments:

apt install should install it. We strongly recommend to configure the system so that you can launch docker command without sudo. See the details. If you do not do this, you may have to put sudo in front of all the docker command invocations.
Install Docker following the instruction at Docker Desktop for Mac
We do not recommend Windows.

Download scamlc script

Download scamlc shell script and make it executable. Move it to somewhere in your PATH:

$ curl > scamlc
$ chmod +x scamlc
$ mv scamlc <somewhere-in-your-path>

Run scamlc to make Docker download the image:

$ scamlc

Follow the section to check your installation.

Build from source

Install OPAM

Install opam command from .

Check it works fine:

$ opam --version

Restart your shell

OPAM installs a hook to your shell to update your shell's PATH for local OCaml installations called “local switches”. Make sure to restart your shell.

Clone the repository

$ git clone
$ cd scaml
$ git checkout salting

Install OCaml locally

Install a local OPAM installation for OCaml 4.07.1 in the directory:

$ opam switch create . ocaml-base-compiler.4.07.1

This should take a while. _opam directory will be created after a successful installation. Do not remove it.

Check the installed OCaml compiler is available in your PATH:

$ which ocamlc

Otherwise, check your OPAM configuration and make its shell hook working correctly.

Install SCaml

$ opam install -y vendors/*/*.opam src/scaml.opam

If successful, there should be the compiler executable under _opam directory:

$ which scamlc

Finally, check your installation by compiling the simplest SCaml program to Michelson.

Check your installation

Create a file with the following content:

open SCaml
let main () () = [], ()

Compile it with scamlc:

$ scamlc

The command should compile the code to then exit silently:

$ scamlc
$ cat
parameter unit ;
storage unit ;
code { { /* top defs */ } ;
       { /* entry point init */ DUP ; CDR ; DIP { CAR } } ;
       { /* entry point code */ PUSH unit Unit ; NIL operation ; PAIR } ;
       DIP { DROP 2 }
       /* final clean up */ } ;

Worked? Congratulations! Now you are ready to write SCaml programs.

Last modified March 6, 2020: hugo (bb420d8)