Homebrew will not install an older PHP branch on macOS
Fix it fast
Most common cause, 1 of 3The branch has been deleted from Homebrew core
Add the tap, mark it trusted, install the fully qualified formula and link it, as the tap's README shows.
brew tap shivammathur/php
brew trust shivammathur/php
brew install shivammathur/php/php@7.4
brew link --overwrite --force shivammathur/php/php@7.4Short answer
Homebrew core keeps a PHP branch only while PHP supports it: old branches are deprecated (warning), then disabled (install fails), then deleted (no available formula). In November 2026 php@7.4 and php@8.0 are gone and php@8.1 is deprecated. Upgrade the project to php@8.4 or newer, or install the old branch from the shivammathur/php tap after brew trust.
Which cause do you have?
Ask Homebrew which PHP formulae it still has, and note which of the three messages above you got. The list shows what core can install today; anything missing from it has been deleted.
brew update
brew search php@Then find the line you see in this list and open its fix:
- 1The branch has been deleted from Homebrew core
No available formula or cask with the name "php@7.4" (php@7.4 and php@8.0 are gone from core) - 2The branch is deprecated or disabled in Homebrew core
has been deprecated because it is not supported upstream! (a warning) or has been disabled because ... (an error that stops the install) - 3The tap is installed but not trusted
Refusing to load formula ... from untrusted tap shivammathur/php, for example when brew link runs after the install itself went through
What does the error look like?
No available formula or cask with the name "php@7.4".Warning: php@8.1 has been deprecated because it is not supported upstream! It will be disabled on 2026-12-31.Refusing to load formula shivammathur/php/php@7.4 from untrusted tap shivammathur/php.
Cause 1 of 3
The branch has been deleted from Homebrew core
You seeNo available formula or cask with the name "php@7.4" (php@7.4 and php@8.0 are gone from core)
Check
No available formula or cask with the name php@7.4 means the branch was deleted from Homebrew core, so only a third-party tap can still provide it. Disabled formulae in homebrew/core are removed automatically one year after their disable date. The shivammathur/php tap still builds PHP from 5.6 up to the newest development branch, for Apple silicon only; its README states that Intel Macs are not supported.
uname -mFix
Add the tap, mark it trusted, install the fully qualified formula and link it, as the tap's README shows. Restart php-fpm or the web server afterwards if one uses PHP.
brew tap shivammathur/php
brew trust shivammathur/php
brew install shivammathur/php/php@7.4
brew link --overwrite --force shivammathur/php/php@7.4Verify
Open a new terminal; php -v reports 7.4.
php -vConfirmed by raw.githubusercontent.com
Cause 2 of 3
The branch is deprecated or disabled in Homebrew core
You seehas been deprecated because it is not supported upstream! (a warning) or has been disabled because ... (an error that stops the install)
Check
has been deprecated (or disabled) because it is not supported upstream means Homebrew core is retiring that PHP branch after PHP ended its support. Deprecated means a warning and the install still runs; disabled means an error and the install fails; removal follows. In November 2026 php@8.1 is deprecated with a disable date of 31 December 2026, and PHP's own table lists 8.2 to 8.6 as the supported branches.
brew search php@
php -vFix
Move the project to a branch that is still supported and installed from core. Check the app on it locally first: run the test suite and composer install under the new version.
brew install php@8.4
brew unlink php@8.1
brew link --overwrite --force php@8.4
composer installVerify
php -v prints 8.4, and the app's tests pass on it.
php -vConfirmed by docs.brew.sh
Cause 3 of 3
The tap is installed but not trusted
You seeRefusing to load formula ... from untrusted tap shivammathur/php, for example when brew link runs after the install itself went through
Check
Refusing to load formula from untrusted tap means Homebrew found the tap but will not run its formulae until you trust it; official taps are always trusted. Running brew trust without arguments prints the taps on your trusted list.
brew trustFix
Trust the tap once, then repeat the command that was refused.
brew trust shivammathur/php
brew link --overwrite --force shivammathur/php/php@7.4Verify
brew trust lists shivammathur/php under the trusted taps, and the link step finishes.
brew trustConfirmed by docs.brew.sh
How do I stop it coming back?
- Keep each project on a PHP branch that PHP still supports, and plan the upgrade before Homebrew's disable date arrives.
- Read the warning lines of brew upgrade; a deprecation notice gives you months of lead time.
- Record the PHP version a project needs (the require php line in composer.json), so a new machine gets the right one.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: Spotless Laundry, EZ Estimater.