11

I was following a couple links that had this same sequence, namely this example. I was unable to get it done successfully. Here is the output from terminal

MacBook-Pro-4:/ SHennessy$ brew tap homebrew/dupes
MacBook-Pro-4:/ SHennessy$ brew tap homebrew/versions
MacBook-Pro-4:/ SHennessy$ brew tap homebrew/homebrew-php
MacBook-Pro-4:/ SHennessy$ brew unlink php56
Error: No such keg: /usr/local/Cellar/php56
MacBook-Pro-4:/ SHennessy$ brew install php70
==> Installing php70 from homebrew/php
Error: You must `brew link libpng` before homebrew/php/php70 can be installed
MacBook-Pro-4:/ SHennessy$ brew link php70
Error: No such keg: /usr/local/Cellar/php70
MacBook-Pro-4:/ SHennessy$

If anybody has any ideas that would be awesome, thanks in advance.

shenn
  • 859
  • 4
  • 17
  • 47

5 Answers5

22

I had more or less the same issue when installing php71.

To resolve it, I had to delete /usr/local/Cellar/php71 using sudo rmdir -rf /usr/local/opt/php71 and then :

brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install php71

Hope it helps.

Everything is now outdated

  • All was migrated to homebrew/homebrew-core
Community
  • 1
  • 1
Sahbi Belgacem
  • 664
  • 8
  • 20
  • 6
    `Error: homebrew/dupes was deprecated. This tap is now empty as all its formulae were migrated.` – MCH Aug 03 '18 at 11:16
8

For MacOS Monterey I faced a similar issue /usr/local/Cellar/php while switching between different php versions

Following steps help me to fix my issue

Step 1

After installing php first link that particular version

brew link php@7.3 //Whatever you installed

Step 2

Switching to another php version use the following commands

brew unlink php@7.3 //Whatever is your current active version
brew link --overwrite --force php@7.4 //Whatever your desired version

Or you can use single command

brew unlink php@7.3 && brew link --overwrite --force php@7.4
Ain
  • 708
  • 1
  • 8
  • 16
4

For php 5.6 & php 7.0

As of now the tap is empty and all of its formulae are migrated to homebrew/core

so i untapped & cleaned

brew untap homebrew/dupes
brew cleanup

And tapped this repo for older php versions

brew tap exolnet/homebrew-deprecated

And resinstalled php versions

brew reinstall php@7.1
brew reinstall php@5.6

Community
  • 1
  • 1
devasghar
  • 61
  • 3
1

For MacOS Catalina you need to do this fallowing commands.

  1. brew tap exolnet/homebrew-deprecated
  2. brew install php@7.1 (or other versions which lower then 7.1)

You can read more about this, just visit here https://getgrav.org/blog/macos-catalina-apache-multiple-php-versions.

Hope my answer will help you.

1

For macOS Venture I had multiple PHP folders under '/usr/local/opt/' so I erased the old versions and then I installed the latest.

Steps I took:
which php
cd /usr/local/opt/
rm -r php@7.0
rm -r php@7.4
rm -r php@8.0

Restart machine and then a php -v