How to Install CockroachDB on Mac OS X


CockroachDB is an up and coming database technology that is focused on building SQL databases that can be distributed across multiple machines. NoSQL hit the scene to solve this exact problem but lost a lot of the advantages that come with SQL. CockroachDB allows businesses to scale up quickly, rebalance nodes, and repair data conflicts all built into the database engine. CockroachDB is a brand new tech that is comparable to Google’s Spanner database technology.

Many software companies that are familiar with the traditional SQL databases but whose dataset is growing too quickly for a single machine are looking at NewSQL technologies like CockroachDB to grow their companies. Since it is a new technology you’ll want to experiment with CockroachDB and in this tutorial we will show you how to install CockroachDB on Mac OS X.

We’ll show the commands step-by-step and explain what each command is doing but if you just want to see the commands scroll to the buttom for the Just The Commands section.


  • For this tutorial all you’ll have to know is how to access the Terminal because we’ll be installing CockroachDB via the Command Line.ß

1. Download the Binary Tar File

First we’ll be downloading the binary file so we’ll want to download it into a directory like ~/Downloads or a directory where you feel comfortable downloading. First we’ll go to our ~/Downloads folder:

cd ~/Downloads

The next step is to download the CockroachDB binary archive file and extract it. Run this next command in your terminal:

curl | tar -xJ

NOTE: This command is actually two commands separated by the |. The first command uses curl to make a http request to to request the binary file. The second tar -xJ extracts the compressed file.

We have successfully downloaded the binary tar file.

2. Copy the Binary into your PATH

The next step is to copy the binary from the previous step into your PATH so you can execute cockroach commands easily in the Terminal. We need to copy it into your /usr/local/bin where OS X looks for binaries to execute. Execute the following command in the Terminal:

cp -i cockroach-v19.1.0.darwin-10.9-amd64/cockroach /usr/local/bin

If you get any permission denied errors you’ll need to run the same command prefixed with sudo and enter your password when prompted. Sudo gives you admin access which is sometimes needed. Here is the command if the previous command gave you permission denied errors:

sudo cp -i cockroach-v19.1.0.darwin-10.9-amd64/cockroach /usr/local/bin

These commands use the cp command, which copies files and directories from one destination to another.

You won’t see any success messages, but if you don’t get any errors then consider it a success.

3. Verify by Starting CockroachDB

Finally we’ll start CockroachDB to confirm everything was installed correctly. We’ll run cockroach on localhost and in insecure mode because we are running a production environment.ßß

cockroach start --insecure --listen-addr=localhost

Here is the output we saw and you should see something similar letting you know that your first CockroachDB cluster is up and running on localhost.

* - Your cluster is open for any client that can access localhost.
* - Any user, even root, can log in without providing a password.
* - Any user, connecting as root, can read or write any data in your cluster.
* - There is no network encryption nor authentication, and thus no confidentiality.
* Check out how to secure your cluster:
CockroachDB node starting at 2019-05-07 20:01:26.565128 +0000 UTC (took 0.3s)
build:               CCL v19.1.0 @ 2019/04/29 18:31:15 (go1.11.6)
webui:               http://localhost:8080
sql:                 postgresql://root@localhost:26257?sslmode=disable
client flags:        cockroach <client cmd> --host=localhost:26257 --insecure
logs:                /Users/alexthompson/Downloads/cockroach-data/logs
temp dir:            /Users/alexthompson/Downloads/cockroach-data/cockroach-temp674995833
external I/O path:   /Users/alexthompson/Downloads/cockroach-data/extern
store[0]:            path=/Users/alexthompson/Downloads/cockroach-data
status:              initialized new cluster
clusterID:           b9421d9c-5322-47fe-b184-d547683ba386


In this tutorial we showed you how to install CockroachDB on your Mac OS X. We hope you’ll experiment with CockroachDB to determine if it is a good fit for your application.

Just The Commands

cd ~/Downloads
curl | tar -xJ
cp -i cockroach-v19.1.0.darwin-10.9-amd64/cockroach /usr/local/bin

OR `js sudo cp -i cockroach-v19.1.0.darwin-10.9-amd64/cockroach /usr/local/bin ```js
cockroach start --insecure --listen-addr=localhost

Pilot the ObjectRocket Platform Free!

Try Fully-Managed CockroachDB, Elasticsearch, MongoDB, PostgreSQL (Beta) or Redis.

Get Started

Keep in the know!

Subscribe to our emails and we’ll let you know what’s going on at ObjectRocket. We hate spam and make it easy to unsubscribe.