How to Upgrade to PHP 8.2 on MacOS with Homebrew
Here is a simple guide to installing or upgrading to PHP 8.2 on MacOS with Homebrew.
1. Update Homebrew
It’s good to make sure Homebrew itself is up to date before we install anything else. To do that we’ll run:
brew update
2. Install PHP 8.2
Next, we’ll install PHP.
brew tap shivammathur/php
brew install shivammathur/php/[email protected]
3. Switch to the new version
Lastly, we’ll want to tell our machine which version to use:
brew link --overwrite --force [email protected]
The repo for this install is available here: https://github.com/shivammathur/homebrew-php
4. Verify
To verify our install, open a new terminal window and run:
php -v
That should show you running php 8.2
🥳