Some of you, like me are only using Ruby to run CocoaPods on your Mac. A few days ago I was helping one of our junior dev’s to fix an issue he encountered after updating OS X El Capitan, I quickly noticed that the error was due to him using the built-in version of Ruby in OS X, and perhaps using sudo to install gems (which is bad, but so much simpler than reconfiguring any settings).

As of July 22nd, 2017 this guide is deprecated.

Does that sound a bit familiar? Ha. You may well have run into some issues after upgrading to 10.11.4 (El Capitan). This is due to Apple locking down certain directories after each major OS X update, so you can no longer access them even if you have root privileges.

Immediately after upgrading to 10.11.4, our junior dev tried to run pod install and resulted in the following error:

pod: command not found

I tried changing a few settings to get things working again and had no success. Allow me to save you about an hour of frustration with the following fix:

First, you will need to restart and boot into OS X’s Recovery Mode to disable (System Integrity Protection), to do this:

Restart your Mac and as soon as the screen turns black hold down the

“Command” key the “R” key

Keep holding both keys until the Apple logo appears on your screen

You will know if you have successfully entered Recovery Mode when the desktop looks like the screenshot below:

Now, click on the “Utilities” menu, and then “Terminal”.

In the Terminal Window that opens type:

csrutil disable

Then press the return key, you should then see the following message:

Now, restart OS X. Your Mac should then restart as normal with (System Integrity Protection) disabled.

Let’s do some reading, let’s find out the proper way to install Ruby using rbenv. By moving forward with this method you will have the ability to manage or install separate Ruby environments.

Note: I am now assuming you read the blog post I linked above, I will now assume you have Xcode’s command line tools installed and are using Homebrew.

Homebrew Housekeeping

Let’s go a head and do some Homebrew updates and cleanup:

Open your terminal app of choice either Terminal or iTerm and type the following command:

brew update && brew upgrade --all && brew cleanup && brew prune && brew doctor

Let’s wait a few…

Note: If you received any Homebrew errors I suggest addressing them before moving forward.

RubyGems Housekeeping

Now let’s do the same with RubyGems:

gem outdated

Note: If you have to update any gems, please use the following command to save you some disk space and time:

gem update [gem name] --no-document

Now, let’s do some cleanup:

gem cleanup

And finally:

gem update --system


Installing CocoaPods

Beautiful, now we can install CocoaPods:

gem install cocoapods

Note: Isn’t nice when you don’t need to use sudo, this is due to rbenv operating entirely under your home directory.

Now let’s do the setup:

pod setup --verbose

Let’s wait a few…

Finally, let’s verify CocoaPods installed correctly:

pod --version

Output should be as of 04/09/2016:


We’re nearly there! One thing to keep in mind is that you’ll have to run a rehash after installing gems (or a new Ruby version) to make sure everything new is linked on your PATH:

rbenv rehash

There you have it! Code on.