简体   繁体   中英

Error when install PHP with brew in OS Monterey

I got php is deleted in OS Monterey, so I try to install it via Homebrew

I already install Homebrew, update tap to shivammathur/php and use this command

brew install shivammathur/php/php@7.4

but I got this response code

fatal: Could not resolve HEAD to a revision
Warning: No available formula with the name "httpd" (dependency of shivammathur/php/php@7.4).
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

When I check brew version with brew --version I got this info

Homebrew 3.3.2
Homebrew/homebrew-core (no Git repository)
Homebrew/homebrew-cask (git revision 5c43c2133d; last commit 2021-11-06)

is that no Git repository issue related with why I cant install php in my device? How to solve this issue

I need this to install composer and install Laravel, so install XAMPP I think is not clear solution right now

Thankyou

I recently had this exact problem and tried

brew tap homebrew/core

However, it didn't work. This did work for me

rm -rf $(brew --repo homebrew/core)
brew tap homebrew/core
brew install php

Hope this helps!

As the output of brew --version says homebrew-core repository is missing, that is why brew is not able to find httpd .

Homebrew/homebrew-core (no Git repository)

Please tap the core repository and try again.

brew tap homebrew/core

尝试在终端中写这个: git -C $(brew --repository homebrew/core) checkout master

One way to intepret this problem, is "how to install brew on osx from scratch deleting previous brew packages and cache files"

Give such interpretation, one could follow the next steps.

how to make a list of all the brew packages installed.

Solution:

  1. Run brew list in the terminal.
  2. This will output a list of all the brew packages installed on your system. (so you can re-install later)

Then:

  1. Uninstall Homebrew

If you installed Homebrew using the installation script, you can uninstall it by running the uninstall script:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

If you installed Homebrew manually, you can uninstall it by running the following commands:

rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
  1. Install Homebrew

Follow the instructions on the Homebrew website to install Homebrew:

https://brew.sh/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM