Install

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:

Ubuntu
apt install docker.io 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.
Mac
Install Docker following the instruction at Docker Desktop for Mac
Windows
We do not recommend Windows.

Download scamlc script

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

$ curl https://gitlab.com/dailambda/scaml/-/raw/salting/docker/scamlc > 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 https://opam.ocaml.org/ .

Check it works fine:

$ opam --version
2.0.3

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 https://gitlab.com/dailambda/scaml
$ 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
.../_opam/bin/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
.../_opam/bin/scamlc

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

Check your installation

Create a file test.ml with the following content:

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

Compile it with scamlc:

$ scamlc test.ml

The command should compile the code to test.tz then exit silently:

$ scamlc test.ml
$ cat test.tz
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)