Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Node.js, PHP and APIs

Homebrew will not install an older PHP branch on macOS

Your error

No available formula or cask with the name "php@7.4".2 more lines it can show

Fix it fast

Most common cause, 1 of 3

The 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.

Fix
brew tap shivammathur/php
brew trust shivammathur/php
brew install shivammathur/php/php@7.4
brew link --overwrite --force shivammathur/php/php@7.4
Did this fix it?
Full steps for this cause: check, fix, verify

Short 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.

  • Applies to Homebrew 7.0, macOS on Apple silicon, php 8.6, php@8.4, php@8.1
  • Updated
  • By Maaz Zindani, Senior Software Engineer

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.

Run this first
brew update
brew search php@

Then find the line you see in this list and open its fix:

  1. 1The branch has been deleted from Homebrew coreNo available formula or cask with the name "php@7.4" (php@7.4 and php@8.0 are gone from core)
  2. 2The branch is deprecated or disabled in Homebrew corehas been deprecated because it is not supported upstream! (a warning) or has been disabled because ... (an error that stops the install)
  3. 3The tap is installed but not trustedRefusing 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.

Check
uname -m

Fix

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.

Fix
brew tap shivammathur/php
brew trust shivammathur/php
brew install shivammathur/php/php@7.4
brew link --overwrite --force shivammathur/php/php@7.4

Verify

Open a new terminal; php -v reports 7.4.

Verify
php -v

Confirmed by raw.githubusercontent.com

Did this fix it?

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.

Check
brew search php@
php -v

Fix

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.

Fix
brew install php@8.4
brew unlink php@8.1
brew link --overwrite --force php@8.4
composer install

Verify

php -v prints 8.4, and the app's tests pass on it.

Verify
php -v

Confirmed by docs.brew.sh

Did this fix it?

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.

Check
brew trust

Fix

Trust the tap once, then repeat the command that was refused.

Fix
brew trust shivammathur/php
brew link --overwrite --force shivammathur/php/php@7.4

Verify

brew trust lists shivammathur/php under the trusted taps, and the link step finishes.

Verify
brew trust

Confirmed by docs.brew.sh

Did this fix it?

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.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.