Install CockroachDB on Mac

On this page Carat arrow pointing down

See Release Notes for what's new in the latest release, v23.1.2. To upgrade to this release from an older version, see Cluster Upgrade.


For CockroachDB v22.2.0 on ARM Macs, spatial features are disabled due to an issue with macOS code signing for the GEOS libraries. Users needing spatial features on an ARM Mac may instead use Rosetta to run the Intel binary or use the Docker image distribution. This issue is expected to be resolved in an upcoming 22.2 patch release. See the GitHub tracking issue for more information.


To deploy a free CockroachDB Cloud cluster instead of running CockroachDB yourself, see the Quickstart.

Use one of the options below to install CockroachDB.

Use Homebrew

For CockroachDB v22.2.x and above, Homebrew installs binaries for your system architecture, either Intel or ARM (Apple Silicon).

For previous releases, Homebrew installs Intel binaries. Intel binaries can run on ARM systems, but with a significant reduction in performance.

  1. Install Homebrew.

  2. Instruct Homebrew to install CockroachDB:

    $ brew install cockroachdb/tap/cockroach
  3. Keep up-to-date with CockroachDB releases and best practices:

If you previously installed CockroachDB via Homebrew, run brew uninstall cockroach before installing the new version. If you installed using a different method, you may need to remove the binary before installing via Homebrew.

Download the binary

For CockroachDB v22.2.x and above, download the binaries for your system architecture, either Intel or ARM (Apple Silicon).

For previous releases, download Intel binaries. Intel binaries can run on ARM systems, but with a significant reduction in performance.

  1. Visit Releases to download the CockroachDB archive for the architecture of your macOS host. The archive contains the cockroach binary and the supporting libraries that are used to provide spatial features.

    You can download the binary using a web browser or you can copy the link and use a utility like curl to download it. If you download the ARM binary using a web browser and you plan to use CockroachDB's spatial features, an additional step is required before you can install the library, as outlined in the next step.

    Extract the archive and optionally copy the cockroach binary into your PATH so you can execute cockroach commands from any shell. If you get a permission error, use sudo.


    If you plan to use CockroachDB's spatial features, you must complete all of the following steps. Otherwise, your installation is now complete.

  2. CockroachDB uses custom-built versions of the GEOS libraries. To install those libraries:

    1. Note that spatial features are currently disabled for Mac ARM users, for whom these steps do not apply. For an upcoming patch release where this functionality is reenabled, if you downloaded the CockroachDB ARM binary archive using a web browser, macOS flags the GEOS libraries in the extracted archive as quarantined. This flag must be removed before CockroachDB can use the libraries. To remove the quarantine flag from the libraries:

      xattr -d lib/libgeos*

      This step is not required for Intel systems.

    2. Copy these libraries to one of the locations where CockroachDB expects to find them. By default, CockroachDB looks for external libraries in /usr/local/lib/cockroach or a lib subdirectory of the CockroachDB binary's current directory. If you place these libraries in another location, you must pass the location in the --spatial-libs flag to cockroach start. The instructions below assume the /usr/local/lib/cockroach location.
      1. Create the directory where the external libraries will be stored:

        mkdir -p /usr/local/lib/cockroach
      2. Copy the library files to the directory:

        cp -i cockroach-v23.1.2.darwin-10.9-amd64/lib/libgeos.dylib /usr/local/lib/cockroach/
        cp -i cockroach-v23.1.2.darwin-10.9-amd64/lib/libgeos_c.dylib /usr/local/lib/cockroach/

        If you get a permissions error, prefix the command with sudo.

  3. Verify that CockroachDB can execute spatial queries.

    1. Make sure the cockroach binary you just installed is the one that runs when you type cockroach in your shell:

      which cockroach
    2. Start a temporary, in-memory cluster using cockroach demo:

      cockroach demo
    3. In the demo cluster's interactive SQL shell, run the following command to test that the spatial libraries have loaded properly:

      > SELECT ST_IsValid(ST_MakePoint(1,2));

      You should see the following output:

      (1 row)

      If your cockroach binary is not properly accessing the dynamically linked C libraries in /usr/local/lib/cockroach, it will output an error message like the one below.

      ERROR: st_isvalid(): geos: error during GEOS init: geos: cannot load GEOS from dir "/usr/local/lib/cockroach": failed to execute dlopen
                Failed running "sql"
  4. Keep up-to-date with CockroachDB releases and best practices:

Use Kubernetes

To orchestrate CockroachDB locally using Kubernetes, either with configuration files or the Helm package manager, see Orchestrate CockroachDB Locally with Minikube.

Use Docker

Running a stateful application like CockroachDB in Docker is more complex and error-prone than most uses of Docker. Unless you are very experienced with Docker, we recommend starting with a different installation and deployment method.

For CockroachDB v22.2.beta-5 and above, Docker images are multi-platform images that contains binaries for both Intel and ARM (Apple Silicon). CockroachDB on ARM systems is experimental and is not yet qualified for production use. Multi-platform images do not take up additional space on your Docker host.

Docker images for previous releases contain Intel binaries only. Intel binaries can run on ARM systems, but with a significant reduction in performance.

  1. Install Docker for Mac. Please carefully check that you meet all prerequisites.

  2. Confirm that the Docker daemon is running in the background:

    $ docker version

    If you do not see the server listed, start the Docker daemon.

  3. Pull the image for the v23.1.2 release of CockroachDB from Docker Hub:

    $ docker pull cockroachdb/cockroach:v23.1.2
  4. Keep up-to-date with CockroachDB releases and best practices:

Build from source

See the public wiki for guidance.

What's next?

By default, each node of a CockroachDB cluster periodically shares anonymous usage details with Cockroach Labs. For an explanation of the details that get shared and how to opt-out of reporting, see Diagnostics Reporting.

Yes No
On this page

Yes No