Skip to content

Instantly share code, notes, and snippets.

Forked from Micka33/
Last active December 19, 2019 22:26
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mars/a303a2616f27b46d72da to your computer and use it in GitHub Desktop.
Save mars/a303a2616f27b46d72da to your computer and use it in GitHub Desktop.
Cassandra on Mac OS X

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL"

Install Java

Install Java SDK for OS X

Install Python

Mac OS X has a copy of Python preinstalled, but this makes sure you get the newest version.

brew install python

Install cql

To use cqlsh, the Cassandra query language shell, you need to install cql:

pip install cql
pip install cassandra-driver

Install Cassandra

This installs the newest stable Apache Cassandra:

brew install cassandra

For an older version, select the formula's commit hash for the version you need:

# example: Cassandra version 2.1.7
brew install

Starting Cassandra

At the end of the install, brew will tell you about two ways to launch Cassandra. The first will launch it when the computer restarts, but this isn't recommended because you may not want to always run Cassandra. Instead use this command:

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.cassandra.plist

Or even easier:

launchctl start homebrew.mxcl.cassandra

and to stop:

launchctl stop homebrew.mxcl.cassandra

On Mavericks, Homebrew failed to move the plist file into LaunchAgents. Which gives this error message:

launchctl: Couldn't stat("/Users/MNCH/Library/LaunchAgents/homebrew.mxcl.cassandra.plist"): No such file or directory

To fix this just issue the following command. Then, try using the launchctl load command again:

cp /usr/local/Cellar/cassandra/2.1.2/homebrew.mxcl.cassandra.plist ~/Library/LaunchAgents/

Cassandra file locations

Properties: /usr/local/etc/cassandra
Logs: /usr/local/var/log/cassandra
Data: /usr/local/var/lib/cassandra/data

Finally cqlsh should connect to cassandra:

$> cqlsh
Connected to Test Cluster at
[cqlsh 5.0.1 | Cassandra 2.1.2 | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.

Have fun with Cassandra!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment