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.



$ brew tap homebrew/dupes


$ brew tap homebrew/versions


$ brew tap homebrew/homebrew-php



To see a list of available configuration options run:

$ brew options php56


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.