Native Installation: MacOs

You need a Unix package manager. There are two popular managers on Mac, MacPorts (aka "port") and Homebrew (aka "brew"). Whatever you do, do not install both. They do not play nicely together.

Check if homebrew is installed by entering the following into your terminal:

brew help
If it returns output other than command not found then homebrew is installed.

Check if macports is installed by typing the following at your terminal.

port version

If you previously installed one of them, make sure it is in working order and fully up-to-date before proceeding.

  • If MacPorts already installed run
    sudo port selfupdate
    sudo port upgrade outdated
    If there are any errors, you need to resolve them before proceeding. Often the easiest way to do that is to uninstall the package manager then reinstall it from scratch. See this page for MacPorts instalation instructions.
  • If Brew already installed run
    brew update
    brew upgrade
  • Nothing already installed: install brew. (It is a little more popular.)
    /bin/bash -c "$(curl -fsSL"
    Follow the instructions this script gives you. If you are having trouble, see the brew home page.

Now, you should have one and only one of the two package managers installed. Proceed as follows.

  • If Homebrew installed run
    brew install opam
  • If MacPorts installed run
    sudo port install opam

After installing opam, continue with the OPAM configuration instructions.