> ## Documentation Index
> Fetch the complete documentation index at: https://cockroachlabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Install CockroachDB on Mac

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

<Note>
  To try CockroachDB Cloud instead of running CockroachDB yourself, refer to the <InternalLink version="cockroachcloud" path="quickstart">Cloud Quickstart</InternalLink>.
  **This page refers to CockroachDB v25.4.** The latest supported production release is CockroachDB v26.1.
  CockroachDB on macOS is experimental and not suitable for production deployments.
  Use one of the options below to install CockroachDB. To upgrade an existing cluster, refer to <InternalLink path="upgrade-cockroach-version">Upgrade to v25.4</InternalLink>. For limitations specific to geospatial features, refer to [Limitations](#limitations).
</Note>

## Use Homebrew

For CockroachDB v22.2.x and above, Homebrew installs binaries for your system architecture, either Intel or ARM ([Apple Silicon](https://support.apple.com/HT211814)).

For previous releases, Homebrew installs Intel binaries. Intel binaries can run on ARM systems, but with a significant reduction in performance. CockroachDB on ARM for macOS is **experimental** and is not yet qualified for production use and not eligible for support or uptime SLA commitments.

1. [Install Homebrew](http://brew.sh/).
2. Instruct Homebrew to install CockroachDB:

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

<Tip>
  If you previously installed CockroachDB via Homebrew, you can <InternalLink path="upgrade-cockroach-version">upgrade</InternalLink> the CockroachDB binary to the next major version or to a patch version using HomeBrew. After updating the binary on each node, restart the `cockroach` process on the node. When upgrading to a new major version, you must complete additional steps to <InternalLink path="upgrade-cockroach-version#finalize-a-major-version-upgrade-manually">finalize</InternalLink> the upgrade. If you need to upgrade through multiple major versions, you must complete each major-version upgrade separately, including finalizing the upgrade, before beginning the next one.
  Before starting the upgrade, review the <InternalLink version="releases" path="v25.4">release notes</InternalLink>, including temporary limitations during the upgrade.
  To upgrade CockroachDB via HomeBrew:

  ```shell theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
  brew update
  ```

  ```shell theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
  brew update
  brew upgrade cockroach
  ```
</Tip>

## Download the binary

For CockroachDB v22.2.x and above, download the binaries for your system architecture, either Intel or ARM ([Apple Silicon](https://support.apple.com/en-us/HT211814)).

For previous releases, download Intel binaries. Intel binaries can run on ARM systems, but with a significant reduction in performance. CockroachDB on ARM for macOS is **experimental** and is not yet qualified for production use and not eligible for support or uptime SLA commitments.

1. Visit <InternalLink version="releases" path="index">Releases</InternalLink> 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 <InternalLink path="spatial-data-overview">spatial features</InternalLink>.

   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 <InternalLink path="cockroach-commands">cockroach commands</InternalLink> from any shell. If you get a permission error, use `sudo`.

   If you plan to use CockroachDB's <InternalLink path="spatial-data-overview">spatial features</InternalLink>, you must complete all of the following steps. Otherwise, your installation is now complete.
2. CockroachDB uses custom-built versions of the <InternalLink path="architecture/glossary#geos">GEOS</InternalLink> libraries. To install those libraries:

   1. Note that <InternalLink path="spatial-data-overview#known-limitations">spatial features are currently disabled for Mac ARM users</InternalLink>, 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:

      ```shell theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
      xattr -d com.apple.quarantine 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 <InternalLink path="cockroach-start">`--spatial-libs` flag to `cockroach start`</InternalLink>. 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-VERSION.darwin-10.9-amd64/lib/libgeos.dylib /usr/local/lib/cockroach/
         ```

         ```
         cp -i cockroach-VERSION.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
      ```

      ```
      /usr/local/bin/cockroach
      ```
   2. Start a temporary, in-memory cluster using <InternalLink path="cockroach-demo">`cockroach demo`</InternalLink>:

      ```
      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">Releases</InternalLink>);
      ```

      You should see the following output:

      ```shell theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
      st_isvalid
      --------------
      true
      (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"
      ```

* Keep up-to-date with CockroachDB releases and best practices:

## Use Kubernetes

To orchestrate CockroachDB locally using [Kubernetes](https://kubernetes.io/), either with configuration files or the [Helm](https://helm.sh/) package manager, see <InternalLink path="orchestrate-a-local-cluster-with-kubernetes">Orchestrate CockroachDB Locally with Minikube</InternalLink>.

## Use Docker

<Danger>
  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.
  CockroachDB's Docker images are [multi-platform images](https://docs.docker.com/build/building/multi-platform/) that contain binaries for both Intel and ARM. Multi-platform images do not take up additional space on your Docker host.
  Experimental images are not qualified for production use and not eligible for support or uptime SLA commitments.

  1. Install a container runtime, such as [Docker Desktop](https://docs.docker.com/desktop/).
  2. Verify that the runtime service is installed correctly and running in the background. Refer to the runtime's documentation. For Docker, start a terminal and run `docker version`. If you get an error, verify your installation and try again.
     <a id="win-docker-step3-{{ page.version.name }}" /> 1. Visit [Docker Hub](https://hub.docker.com/r/cockroachdb/cockroach) and decide which image tag to pull. Releases are rolled out gradually. Docker images for a new release are published when other binary artifacts are published. The following tag formats are commonly used, although other tags are available.
</Danger>

| Tag                                 | Example                                                                                                                                                                                                             | Description                                                                                                                                                                                                                                                 |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| An exact patch                      | \`\`                                                                                                                                                                                                                | Pins a cluster to an exact patch. The cluster is upgraded to a newer patch or major version only when you pull a newer tag.                                                                                                                                 |
| Latest patch within a major version | `latest-v25.4`                                                                                                                                                                                                      | Automatically updates a cluster to the latest patch of the version you specify. This tag is recommended in production, because it keeps your cluster updated within a major version but does not automatically upgrade your cluster to a new major version. |
| `latest`                            | The latest patch within the latest major version. This is the default if you do not specify a tag. It updates your cluster automatically to each new patch and major version, and is not recommended in production. |                                                                                                                                                                                                                                                             |

Copy the tag you want to pull.

1. Pull the image. Replace <code>{'{TAG}'}</code> with the tag from the previous step.

```shell theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
docker pull cockroachdb/cockroach:{TAG}
```

1. Start a cluster by starting the container on each node using `docker start`. The default command is `cockroach start`. Pass your desired flags as the final argument. For details, refer to .

## Build from source

See the [public wiki](https://wiki.crdb.io/wiki/spaces/CRDB/pages/181338446/Getting+and+building+CockroachDB+from+source) for guidance. When building on the ARM architecture, refer to [Limitations](#limitations).

## Limitations

CockroachDB runtimes built for the ARM architecture have the following limitations:

* CockroachDB on ARM for macOS is **experimental** and is not yet qualified for production use and not eligible for support or uptime SLA commitments.
* Clusters with a mix of Intel and ARM nodes are untested. Cockroach Labs recommends that all cluster nodes have identical CockroachDB versions, hardware, and software.
* Floating point operations may yield different results on ARM than on Intel, particularly [Fused Multiply Add (FMA) intrinsics](https://developer.arm.com/documentation/dui0375/g/Compiler-specific-Features/Fused-Multiply-Add--FMA--intrinsics).
* When [building from source](#install-source) on ARM, consider disabling FMA intrinsics in your compiler. For GCC, refer to [Options That Control Optimization](https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html) in the GCC documentation.

## What's next?

* If you're just getting started with CockroachDB:
  * [Create a CockroachDB Cloud account](https://cockroachlabs.cloud/signup?experience=enterprise) where you can <InternalLink path="licensing-faqs">generate and manage licenses</InternalLink> for CockroachDB installations
  * <InternalLink path="start-a-local-cluster">Start a cluster locally</InternalLink> and talk to it via the built-in SQL client
  * <InternalLink path="learn-cockroachdb-sql">Learn more about CockroachDB SQL</InternalLink>
  * <InternalLink path="example-apps">Build a simple application</InternalLink> with CockroachDB using PostgreSQL-compatible client drivers and ORMs
  * <InternalLink path="demo-replication-and-rebalancing">Explore CockroachDB features</InternalLink> like automatic replication, rebalancing, and fault tolerance
* If you're ready to run CockroachDB in production:
  * Review the <InternalLink path="recommended-production-settings">Production Checklist</InternalLink>
  * <InternalLink path="manual-deployment">Deploy CockroachDB manually</InternalLink> or <InternalLink path="kubernetes-overview">use an orchestration system like Kubernetes</InternalLink>

## Limitations

On macOS ARM systems, <InternalLink path="spatial-data-overview">spatial features</InternalLink> are disabled due to an issue with macOS code signing for the [GEOS](https://libgeos.org/) libraries. Users needing spatial features on an ARM Mac may instead [run the Intel binary](#install-the-binary) or use the[Docker container image](#use-docker).
