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
The next step is to download the CockroachDB binary archive file and extract it. Run this next command in your terminal:
NOTE: This command is actually two commands separated by the
|. The first command uses curl to make a http request to
cockroachdb.com 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:
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:
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.ßß
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.
* WARNING: RUNNING IN INSECURE MODE!
* - 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: https://www.cockroachlabs.com/docs/v19.1/secure-a-cluster.html
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)
client flags: cockroach <client cmd> --host=localhost:26257 --insecure
temp dir: /Users/alexthompson/Downloads/cockroach-data/cockroach-temp674995833
external I/O path: /Users/alexthompson/Downloads/cockroach-data/extern
status: initialized new cluster
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
sudo cp -i cockroach-v19.1.0.darwin-10.9-amd64/cockroach /usr/local/bin
cockroach start --insecure --listen-addr=localhost
Pilot the ObjectRocket platform free for 30 Days
It's easy to get started. Imagine the time you'll save by not worrying about database management. Let's do this!PILOT FREE FOR 30 DAYS