macOS 14.0 Sonoma Apache Setup: Upgrading Homebrew

Special Edition for those that have prior installations

2 mins
Special Edition: macOS 14.0 Sonoma Development Environment

This is a guide to help those with prior Homebrew mutliple PHP-based installations that are looking to upgrade to the new Hombrew/core PHP setup from the prior Homebrew/php keg which is now deprecated.

With the deprecation of Homebrew/php tap, many of the prior formulaes we used in this guide are no longer available. The cleanest way to migrate from the old brew formulae to the new pecl package approach is to remove everything PHP-related and reinstall with the new instructions.

The first step in this process is to update all the latest packages then upgrade them. This will actually 'migrate' the core PHP packages (which are the only ones supported), but there's a bunch of symlinks utilized that could cause problems down the road, so after upgrading, we'll remove all PHP packages, to provide a fresh start:

brew update
brew upgrade
brew cleanup

You can then double check the current installed PHP packages with:

brew list | grep php

Now we just need to remove everything:

brew uninstall --force php56 php56-apcu php56-opcache php56-xdebug php56-yaml
brew uninstall --force php70 php70-apcu php70-opcache php70-xdebug php70-yaml
brew uninstall --force php71 php71-apcu php71-opcache php71-xdebug php71-yaml
brew uninstall --force php72 php72-apcu php72-opcache php72-xdebug php72-yaml
brew uninstall --force php80 php80-apcu php80-opcache php80-xdebug php80-yaml
brew uninstall --force php81 php81-apcu php81-opcache php81-xdebug php81-yaml
brew uninstall --force php82 php82-apcu php82-opcache php82-xdebug php82-yaml
brew cleanup

Don't worry if you don't have all these packages installed, this is just a cumulative list and it will skip over anything that's not installed.

Now we can check to see if anything PHP-related is left:

brew list | grep php

If you don't see anything you are all good. If something is still left, you can uninstall those individually using the same brew uninstall --force syntax as above.

Now we want to clean out the old configuration options for PHP:

rm -Rf /usr/local/etc/php/*

Now you've cleaned up your prior installation, you can jump to the PHP Installation section of Part 1 of the guide.

Grav Premium
Turbo-charge your Grav site - from the creators of Grav