Benedikt Meurer JavaScript Engine Hacker and Programming Language Enthusiast.


The ocamlnat project provides a new native code OCaml toplevel ocamlnat, which is mostly compatible to the byte code toplevel ocaml, but up to 100 times faster. It is based on the optimizing native code compiler, the native runtime and an earlier prototype by Alain Frisch. It is build upon Just-In-Time techniques and currently supports Unix-like systems (i.e. Linux, BSD or Mac OS X) running on x86 or x86-64 processors. Support for additional architectures and operating systems is planned, but not yet available.

See below for download links and installation instructions.

Features #

  • Up to 100x faster than the byte code toplevel, as detailed here and here.
  • Builtin Findlib support, available via #use "topfind";; similar to the byte code toplevel.

Download #

Installation #

Download the latest source code release ocamlnat-0.1.1.tar.bz2 (or any other release from the list above), and extract the source distribution tarball using the following command:

tar xjf ocamlnat-0.1.1.tar.bz2
cd ocamlnat-0.1.1

The installation is similar to the installation of any other OASIS based software package, so make sure to consult the INSTALL and README files if you run into trouble.

Assuming that you want to install ocamlnat into /usr/local on a Unix-like system (i.e. Linux, BSD or Mac OS X), proceed as follows:

ocaml -configure
ocaml -build

These are basically the standard configuration and build steps as described in the INSTALL file. Feel free to pass additional parameters the configuration phase if you need to.

The final step is to install ocamlnat into the selected binary directory (i.e. /usr/local/bin).

sudo ocaml -install

Et voila, now you can use your new native toplevel ocamlnat. Assuming that you installed it into /usr/local, then you can execute it using the following command, which presents you with an interactive toplevel prompt, i.e.:

$ /usr/local/bin/ocamlnat
        ocamlnat version 0.1.1 (OCaml version 3.12.1)


You can use it as a drop-in replacement for the byte code toplevel ocaml in almost all cases, and enjoy a performance boost of up to 100x (compared to the byte code toplevel), as detailed here and here.

Publications #

License #

ocamlnat is licensed under the Q Public License similar to the OCaml distribution. See the LICENSE file for details and exceptions.

Source code

Available on GitHub:

Download it in either zip or tar formats.

Clone the project with Git by running:

git clone git://

Bug Reports

If you come across any problems, please create a ticket and we will try to get it fixed as soon as possible.

Report a Bug


Once you have made your commits:

  1. Fork ocamlnat.
  2. Create a topic branch - git checkout -b my_branch
  3. Push to your topic branch - git push origin my_branch
  4. Create a Pull Request from your topic branch.
  5. That's it!

Fork ocamlnat

Copyright © 2010-2011 Benedikt Meurer. See the LICENSE file for details.