OCaml Getting started with OCaml Installation or Setup

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

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

#


Got any OCaml Question?