@DmkA64

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

homebrewとphpのインストールについて

解決したいこと

homebrewを使ってphpをインストールしようとしていますが上手くいきませんのでご助言をいただきたいです。

①homebrewのインストールについて
homebrewをインストールしようとすると、以下のような表示になります。

mac@macnoMacBook-Air ~ % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew

Press RETURN/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /usr/sbin/chown -R mac:admin /usr/local/Homebrew
==> Downloading and installing Homebrew...
Updating files: 100% (2882/2882), done.
HEAD is now at 5080312bd Merge pull request #13598 from Rylan12/ignore-missing-libraries-simulate-linux
error: Not a valid ref: refs/remotes/origin/master
fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

②homebrewがインストールされているか確認してみたところ、以下のような表示になりました。

mac@macnoMacBook-Air ~ %  brew -v 
Homebrew 3.5.6-28-g5080312
Homebrew/homebrew-core (no Git repository)
Homebrew/homebrew-cask (git revision 2a0ab69f23; last commit 2022-07-23)

③他のサイトには正常にインストールされていれば以下のような表示になるとありましたので、"no Git repository"のような表示があるのはおかしいような気がするのですが、色々調べてもよくわからない状況です。

$ brew -v
Homebrew 2.2.10
Homebrew/homebrew-core (git revision 56d51)

④とりあえずphpのインストールを試してみましたが、以下のような表示となってしまい、正常にインストールできておりません。

Last login: Sun Jul 24 19:28:02 on ttys000
mac@macnoMacBook-Air ~ % brew install php@7.4
Running `brew update --auto-update`...
error: Not a valid ref: refs/remotes/origin/master
fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

⑤また、brew doctorをコマンドしてみると以下のような表示となりました。

Warning: Homebrew/homebrew-core was not tapped properly! Run:
  rm -rf "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core"
  brew tap homebrew/core

Warning: Some taps are not on the default git origin branch and may not receive
updates. If this is a surprise to you, check out the default branch with:
  git -C $(brew --repo homebrew/core) checkout 
mac@macnoMacBook-Air ~ % 

これらの状況から何か問題があるようには思い色々と調べてはみたものの、解決には至らないため、解決策についてご助言をいただけたら幸いです。
よろしくお願いします。

0 likes

1Answer

Himebrewのアンインストールのスクリプトを流し、次いでインストールのスクリプトを流したらなんかうまくいった的のIssue見つけました。

また、それに加えてgitの設定も変更行っている解決策も見つかりました。

いずれかを実行してみてはいかが?

0Like

Comments

  1. @DmkA64

    Questioner

    homebrewのアンインストールをした後に再インストールをしたら解決しました。
    ありがとうございました。

Your answer might help someone💌