Install PHP 5.6 in OSX 10.10 using Homebrew

I like to replace the default php install in OSX with a more recent version. I'll show you the steps in order to easily do it.

Taps

dupes:

$ brew tap homebrew/dupes

versions:

$ brew tap homebrew/versions

homebrew-php:

$ brew tap homebrew/homebrew-php

taps

Options

To see a list of available configuration options run:

$ brew options php56

Install

And install quite easily:

$ brew install php56

After your dependencies are isntalled it should finish off with php:

brew install php-56

That wasn't hard at all.

Now, I only really use PHP CLI, so I need to update my .zshrc file (.bashrc if you use bash instead of zsh). I just add this to the end:

# Homebrew PHP CLI
export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH"

After reloading your terminal and typing which php you should see the new version:

which php

There are more detailed instructions here if this isn't what you were looking for.