OCaml Getting started with OCaml Installation or Setup


Example

Installing OPAM

OPAM is a package manager for OCaml. It builds and manages compiler versions and OCaml libraries for you easily.

The easiest way to install OPAM on your operating system is to use a package manager for your system. e.g apt-get, yum or homebrew.

Mac OSX Installation Instructions

Update homebrew formulae and install OPAM.

brew update
brew install opam

Ubuntu Installation Instructions

add-apt-repository ppa:avsm/ppa
apt-get update
apt-get install ocaml opam

Compiling from source

wget http://caml.inria.fr/pub/distrib/ocaml-4.03/ocaml-4.03.0.tar.gz
tar xf ocaml-4.03.0.tar.gz
cd ocaml-4.03.0
./configure -prefix installation_path
make world.opt
make install

Initializing OPAM

Once you have OPAM installed, run opam init and follow the instructions.

Once done you should be able to run the OCaml interpreter from your shell.

$ ocaml
        OCaml version 4.03.0

#