This guide is intended to give you a general idea of how to get started with OCaml. An easy way to handle OCaml packages is Opam. Installation on MacOS and Linux distributions has many steps but is straight forward. If you have a working OCaml Environment you can skip to the OQaml setup section.
-
Install OCaml package manager:
- Ubuntu
apt-get install opam
- MacOS
brew install opam
-
Initialize the package manager
opam init
-
To interact with OQaml you will need to set up OCaml version 4.04.2. You can do this with opam as follows
opam switch 4.04.2
-
Repeat steps 3 to ensure your environment is set up with the right version dependencies (Don't forget to check your
.bashrc
)opam config env
There will be several ENV variables displayed. Make sure to put them into your .bashrc
and source it. Run ocaml --version
and confirm that is displays The OCaml toplevel, version 4.04.2
. You are now all set up in the right OCaml environment. To get install OQaml we need to install some more dependencies and OCaml packages.
-
Setting up jbuilder; an OCaml build system manager:
opam install jbuilder
Depending on your distribution of Linux or MacOS there might be OS dependencies missing. Opam is giving you good guidelines to check for those dependencies and help you install missing ones. E.g. for a missing
conf-m4.1
dependency opam suggests to runopam depext conf-m4.1
which searches and helps installing missing the OS libraries.
-
Install utop to install a powerful OCaml REPL
opam install utop
-
Installing Core_extended
opam install core_extended
-
The current version of OQaml depends on the development version of Owl, which needs to be installed by hand. More detailed install instructions are found in its README, but here is a short list:
git clone [email protected]:ryanrhymes/owl.git
cd owl
- ensure
openblas
andlapacke
are installed on your OS. opam install ctypes dolog eigen gsl oasis plplot atdgen
. In this process there might be more OS dependencies you have to install. Simply let opam help you to figure out which OS libraries are missing with a couple ofopam depext <X>
.make all
make install
-
You are now ready to install OQaml. To this end move into the OQaml directory and run
make all && make install