Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Installing on Mac

Installing Couchbase Server and PHP or Ruby SDK's on Mac OSX

Order of Operations

  1. Handle post Mountain Lion upgrade if you had Homebrew
  2. Install/Upgrade Couchbase Server
  3. Install Homebrew (if you don't have it already)
  4. Install latest XCode
  5. Install XCode Command Line Tools
  6. Install libcouchbase C library
  7. Install PHP or Ruby SDK


Mountain Lion

If you have upgraded to Mountain Lion after installing Homebrew on Lion, this is a good guide to getting your command line setup: The Hitchhiker's Guide to Riding A Mountain Lion

Highlights on ThoughtBot's blog post: (assuming you have Homebrew already)
$ sudo chown -R `whoami` /usr/local
$ brew update
$ brew tap homebrew/dupes
$ brew install apple-gcc42



Install Couchbase Server & Homebrew (if you don't have it already)

  • First go ahead and install Couchbase 2.0 Server if you haven't done so: Couchbase Server 2.0

    • If you are upgrading from Couchbase 1.8.x, Membase, or earlier versions, before installing Couchbase 2.0:
    • Quit Couchbase 1.8.x or earlier
    • After you quit Couchbase, open Activity Monitor, and kill the epmd process (Erlang Port Mapper)
    • Delete ~/Library/Application Support/Couchbase (also deletes data!)
    • Delete ~/Library/Application Support/Membase (also deletes data!)
    • Now you can drag Couchbase to Applications and install

. .

  • Install Homebrew:
$ ruby -e "$(curl -fsSkL"



System Setup for Command Line Builds

Use A or B to install gcc 4.2 and llvm gcc 4.2

  • A: Install XCode, then go to to Preferences and Downloads Tab and Install Command Line Tools
    • If you have old versions of XCode, I recommend removing them and only having the latest XCode installed
    • Then install Command Line Tools via XCode > Preferences... > Downloads Tab > Command Line Tools
  • B:Or, alternatively, you can install apple gcc via homebrew, however if you are installing Ruby/RVM, you'll need the XCode Command Line Tools for dependencies:
$ brew install apple-gcc42

Check your Homebrew to make sure there are no problems, if there are, it usually has good recommendations to fix, but as I said above, having old versions of XCode and not having Command Line Tools that are updated is usually the culprit in brew doctor stuff:

$ brew doctor

If you still get warnings or problems that you don't understand, let me know: and I can try to help

Finally, you may need to do this, but try installing libcouchbase below first:

$ sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2



Install libcouchbase C library SDK dependency

We use a C library to make communication extremely optimized and fast between client SDK's and Couchbase Server. It is the basis for the Ruby, PHP, and Python SDK's. So we have install this libraries and headers first before installing the language SDK's.

$ brew install



Install PHP SDK

If all goes well, now we can just follow instructions on Couchbase PHP page with Step 1:



Install Ruby SDK

If you have RVM installed, and you have libcouchbase installed from above, you can now go to Step 1:

$ gem install couchbase --pre

More Help

If you run into problems, ping me on twitter: @scalabl3 or email me at

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