skip to Main Content
diptonarh@Diptos-MacBook-Air ~ % brew unlink php
Error: No such keg: /opt/homebrew/Cellar/php
diptonarh@Diptos-MacBook-Air ~ % 

How can i solve the error

Error: No such keg: /opt/homebrew/Cellar/php

note: I am trying to use brew for downgrade.

2

Answers


  1. You should specify the php version you are about to unlink.

    For example:
    brew unlink [email protected]

    Login or Signup to reply.
  2. If you do have PHP 8 installed it might not have been via brew. As you did not say which operating system you are using it’s impossible for us to know how it was originally installed.

    However, PHP 7 is now obsolete so you will not be able to install it directly using brew, it will give you an error message.

    You can install PHP 7 on a Mac using the brew tap shivammathur/php which you install first

    brew tap shivammathur/php
    

    followed by the command to install PHP

    brew install shivammathur/php/[email protected]
    

    then set up your path

    echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
    echo 'export PATH="/opt/homebrew/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search