Install Brew On Osx



This page describes how to install and configure opam. For further help on howto use opam, either read opam --help or move on to theUsage guide.

Upgrading from a previous version

Generally, you should just reproduce the same installation steps as for theoriginal installation: upgrade from your system's package manager, or re-run thebinary installer. Opam will automatically update its internal repository at~/.opam on first run if needed (if using our installer script, a backup can bemade automatically).

To upgrade shell scripts, and enable sandboxing, don't forget to run opam init--reinit -ni.

Then see the Upgrade guide to check the changes.

Binary distribution

OSX will know that you do not have the command line tools and prompt you to install them! To check if they exist, xcode-select -p will print the directory. Alternatively, the return value will be 2 if they do NOT exist, and 0 if they do.

  1. # Homebrew brew install gpatch brew install opam # MacPort port install opam. See also howto setup Emacs.app for Opam usage. Versions 18.04 and newer. There is a ppa available that contains the current stable version of opam. Add-apt-repository ppa:avsm/ppa apt update apt install opam Versions older than 18.04. Use the binary distribution.
  2. If you perform a fresh install of Xcode, you will also need to add the commandline tools by running xcode-select-install on the terminal. While OS X comes with a large number of Unix utilities, those familiar with Linux systems will notice one key component missing: a decent package manager.
  3. Install GitLab Runner on macOS. GitLab Runner can be installed and updated on macOS. There are two methods for installing GitLab Runner on macOS: Manual installation. This method is officially supported and recommended by GitLab. Homebrew installation. Install with Homebrew as an alternative to manual installation.

The quickest way to get the latest opam up and working is to runthis script:

This will simply check your architecture, download and install the properpre-compiled binary, backup your opam data if from an older version, and runopam init.

(If you have trouble with curl, justdownload the scriptand run sh install.sh)

We provide pre-compiled binaries for:

  • Linux i686, amd64, arm7, arm64
  • OSX (intel 64 bits, arm64)
  • We do not at present provide an official Windows distribution of opam, but please see this separately maintained distribution(other platforms are available using the other methods below)

If you don't like scripts, you can just pick your downloadhere, put it in your PATH asopam, and set it as executable, e.g.

Note that this script is intended for end-users, not CI. For that purpose,you can use pre-built Docker images for variousconfigurations.

Using your distribution's package system

Install Brew On Osx Sierra

This is generally the recommended way, when available and up-to-date (youcan check here the latestavailable release per distribution). Here is a list of supported distributions:

Arch Linux

The opampackage is available in the official distribution. To install it simply run:

If you'd like to use the development version there is an opam-gitpackage available in the AUR.Assuming you have yay installed just run the following command:

Debian

Binary packages of opam are available for thestable,testing andunstable distributions, from the officialrepositories. You should be set with:

Exherbo

Thedev-ocaml/opampackage can be installed with the command:

You might need to add the ::ocaml-unofficial repository first:

Fedora, CentOS and RHEL

The opam package for Fedora can be installed with the command:

There is not currently a package for CentOS/RHEL. You will need to use ourpre-built binaries, or build from sources.

Mageia

The opam package for Mageia can be installed with the command:

OpenBSD

The opam package for OpenBSD can be installed with the command (since OpenBSD 5.7):

FreeBSD

Opam is available in the ports and packages tree on FreeBSD 11 or higher.

OSX

Opam packages for homebrew and MacPorts are available.homebrew need a prior installation of gpatch, as opam uses gnu-specific options.

See alsohowto setup Emacs.appfor Opam usage.

Ubuntu

Versions 18.04 and newer

There is a ppa available that contains the current stable version of opam.

Versions older than 18.04

Use the binary distribution. Instructions provided at https://opam.ocaml.org/doc/Install.html#Binary-distribution

Windows

Full support for Windows is planned for opam 2.2, and we expect to provide an opam package in Chocolatey and winget. If you'd like to help out, please get in touch!

Guix & Guix System

Osx

The opam package for guix can be installed with the command:

From Sources

Getting the Sources

Sources of the latest stable version of opam are available on Github:

You can also download the full archives, including opam dependencies (thesedon't require any extra downloads, just the OCaml compiler -- 4.02.3 or laterfor the latest version):

  • 2.0.2
    • MD5: 8780b0dc4209451e21330b6a3e663fe9
    • SHA384: 2ecbdd28840564f873af2f56fcb337d49477f4b63a39ed3878a38eb55bbda67d7561a8deee697c36d7be50ff36a8fe21
  • 1.2.2
    • MD5: 7d348c2898795e9f325fb80eaaf5eae8
    • SHA384: 3a0a7868b5f510c1248959ed350eecacfe1abd886e373fd31066ce10871354010ef057934df026e5fad389ead6c2857d

Install Brew On Osx 10.13

Follow the instructions in the includedREADME.md to get opam built andinstalled from there.

Note that opam1.2.2 doesn't build from source with OCaml 4.06.0. Use this command to compile lib_ext

Note

Brew

Check out our guide for installing Python 3 on OS X.

Mac OS X comes with Python 2.7 out of the box.

You do not need to install or configure anything else to use Python. Having saidthat, I would strongly recommend that you install the tools and librariesdescribed in the next section before you start building Python applications forreal-world use. In particular, you should always install Setuptools, as it makesit much easier for you to install and manage other third-party Python libraries.

Install Brew On Osx Time Machine

The version of Python that ships with OS X is great for learning, but it’s notgood for development. The version shipped with OS X may be out of date from theofficial current Python release,which is considered the stable production version.

Doing it Right¶

Let’s install a real version of Python.

Before installing Python, you’ll need to install a C compiler. The fastest wayis to install the Xcode Command Line Tools by runningxcode-select--install. You can also download the full version ofXcode from the Mac App Store, or theminimal but unofficialOSX-GCC-Installerpackage.

Note

If you already have Xcode installed, do not install OSX-GCC-Installer.In combination, the software can cause issues that are difficult todiagnose.

Note

Install Brew On Osx Mojave

Install Brew On Osx

If you perform a fresh install of Xcode, you will also need to add thecommandline tools by running xcode-select--install on the terminal.

While OS X comes with a large number of Unix utilities, those familiar withLinux systems will notice one key component missing: a decent package manager.Homebrew fills this void.

To install Homebrew, open Terminal oryour favorite OS X terminal emulator and run

The script will explain what changes it will make and prompt you before theinstallation begins.Once you’ve installed Homebrew, insert the Homebrew directory at the topof your PATH environment variable. You can do this by adding the followingline at the bottom of your ~/.profile file

Now, we can install Python 2.7:

Because python@2 is a “keg”, we need to update our PATH again, to point at our new installation:

Homebrew names the executable python2 so that you can still run the system Python via the executable python.

Setuptools & Pip¶

Homebrew installs Setuptools and pip for you.

Setuptools enables you to download and install any compliant Pythonsoftware over a network (usually the Internet) with a single command(easy_install). It also enables you to add this network installationcapability to your own Python software with very little work.

pip is a tool for easily installing and managing Python packages,that is recommended over easy_install. It is superior to easy_installin several ways,and is actively maintained.

Virtual Environments¶

A Virtual Environment (commonly referred to as a ‘virtualenv’) is a tool to keep the dependencies required by different projectsin separate places, by creating virtual Python environments for them. It solves the“Project X depends on version 1.x but, Project Y needs 4.x” dilemma, and keepsyour global site-packages directory clean and manageable.

For example, you can work on a project which requires Django 1.10 while alsomaintaining a project which requires Django 1.8.

To start using this and see more information: Virtual Environments docs.

This page is a remixed version of another guide,which is available under the same license.