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: We suggest installing brew. It is a little more popular. However, we just learned that, unfortunately, brew is not fully supported on ARM processors so if you bought one of the newest Macs, over the last year or so, you may have an ARM processor. You should be able to click on the apple symbol on your computer in the upper left and go to "About". There, it should tell you what kind of processor you have. If you have one of the latest Macs, with an ARM processor, you will (we believe) get an error message when you try to use the command below. (if you use the command below and don't get an error message, you are probably good to go. Yay!) However, this web page tells you a workaround. Basically, you just have to prefix the install command below with "arch -x86_64 " and any time we have "brew ..." in the commands that follow, you have to instead type "arch -x86_64 brew ..." One of our TAs has installed opam this way.
    /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.