comment 0

Installing OCaml – 2

Windows, Linux and Mac

!Attention! OCaml is very available for windows. I am not. I had always been a Linux guy and will encourage you to use UNIX-like environments. If you have a windows only PC, I would suggest you to use containers like docker to get a UNIX environment. Ya ya ya :/ , here is the windows installation guide too (official).

Let’s get Started!

Installing on Linux

  • I would recommend you to install OCaml using its package manager called OPAM.
  • Ubuntu
    add-apt-repository ppa:avsm/ppa
    apt-get update
    apt-get install ocaml ocaml-native-compilers camlp4-extra opam
  • Cent OS 7
  • cd /etc/yum.repos.d/
    wget http://download.opensuse.org/repositories/home:ocaml/CentOS_7/home:ocaml.repo
    yum install opam
  • Mac Os
  • brew install opam
  • Configuring OPAM
  • OPAM uses ~/.opam by default for its package database, so you need to
    initialize it first by running (as a normal user) and then run the following to initialize your environment variables:

    opam init
    eval opam config env
    opam config setup -a
    

    To export the needed variables every time, add them to your dotfiles.
    * On Bash, add them to `~/.bash_profile`.
    * On Zsh, add them to `~/.zprofile` or `~/.zshrc` instead.

  • Now run opam list to see the available packages.
  • [siddhant:~]$ opam list
    # Installed packages for system:
    base-bigarray  base  Bigarray library distributed with the OCaml compiler
    base-threads   base  Threads library distributed with the OCaml compiler
    base-unix      base  Unix library distributed with the OCaml compiler
  • Type ocaml in your console and this should bring up the interactive interface! (To exit type exit 0;;) Note the two semicolon at the end!
  • [siddhant:~]$ ocaml
            OCaml version 4.03.0
    
    # exit 0;;
The wait is over .Let’s dive into OCaml : OCaml Concepts

Leave a Reply

Your email address will not be published. Required fields are marked *