Install PHP 7 with Homebrew:
brew install [email protected]
If you get the error:
Error: [email protected] has been disabled because it is a versioned formula!
Then run:
brew tap shivammathur/php && brew install shivammathur/php/[email protected]
Symlink the formula:
brew link --force --overwrite [email protected]
Start the service:
brew services start [email protected]
Export the path if you’re using Zsh:
echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc
Or export the path if you’re using Bash:
echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.bashrc
echo 'export PATH="/opt/homebrew/opt/[email protected]/sbin:$PATH"' >> ~/.bashrc
See Gist: