Skip to content

Instantly share code, notes, and snippets.

@joelmellon
Forked from shashankmehta/setup.md
Last active November 8, 2017 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joelmellon/1e78200a39d8c3193c518afe6427acc0 to your computer and use it in GitHub Desktop.
Save joelmellon/1e78200a39d8c3193c518afe6427acc0 to your computer and use it in GitHub Desktop.
Setup PHP and Composer on OSX via Brew

First install Brew on your MAC

  • Setup Brew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • brew update
  • brew tap homebrew/dupes
  • brew tap homebrew/php
  • Install PHP 7.1.+ brew install php71
  • Install mcrypt: brew install mcrypt php71-mcrypt
  • Finally, install composer: brew install composer

Now if you run $ php -v, you will get PHP 5.5 or something. This is the default PHP version that is shipped with OSX and cannot be removed. You just need to edit your path to ensure that PHP 7.1 is picked up.

export PATH="$(brew --prefix homebrew/php/php71)/bin:$PATH"

To debug any issue with any package, you can run brew info php71 etc.

Also, if you are getting seemingly unrelated errors, make sure to update bash/zsh: brew upgrade bash and brew upgrade zsh.

If everything is setup correctly, running $ php -v should give you 7.1.+.

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