LoginSignup
1
0

More than 1 year has passed since last update.

Homebrewが古くなっていたので再インストールしたら躓いた件

Last updated at Posted at 2023-01-29

Homebrewインストールしようとするものの...

最近は仮想環境上で構築することが多かったが、mac OSを使うにあたりHomebrewをインストールしようとすると、下記の警告が出た。

brew install git
Updating Homebrew...

Warning: You are using macOS 12.5.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this pre-release version.

brew doctorで問題チェックしてみる。

brew doctor

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: No developer tools installed.
Install the Command Line Tools:
  xcode-select --install


Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
/usr/local/include/node/cppgc/allocation.h
などの/usr/local/include/配下のファイル名


Warning: You are using macOS 12.5.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this pre-release version.


Warning: Could not find an SDK that supports macOS 12.5.
You may have have an outdated or incompatible Xcode.

Please update Xcode or uninstall it if no updates are available.

アンインストール

上記手順のコマンドを試してみる。

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Error: The Ruby Homebrew uninstaller is now disabled and has been rewritten in
Bash. Please migrate to the following command:
  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

今は使えないようなので、エラーででたアンインストールコマンドを使用する。

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
Warning: This script will remove:
ユーザー配下のファイル名

Are you sure you want to uninstall Homebrew? This will remove your installed packages! [y/N] y
Homebrewをアンインストールするか聞いてくるので、問題なければyをする。
Homebrew uninstalled!が出たことを確認する。

インストールを試みるが...

改めてインストールしてみる。

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Error: 
  homebrew-core is a shallow clone.
To `brew update`, first run:
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
This command may take a few minutes to run due to the large size of the repository.
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
Failed during: /usr/local/bin/brew update --force --quiet

エラー文にunshallowコマンドが求められているので試してみる。
unshallowコマンドについては下記の記事に書かれている。

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

ファイル消去

brew doctorで再び状況確認してみる。

brew doctor

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
/usr/local/include/配下のファイル名

上記の記事をもとにフォルダごとを消す。

sudo rm -R /usr/local/include/node
brew doctor
Your system is ready to brew.

やっと土壌が整ったようだ。

brew update

git fetch --unshallow
fatal: not a git repository (or any of the parent directories): .git

git fetchしようとしたが上手くいかなったので、上記手順をもとにgit initを行う。

git init
Initialized empty Git repository in 作業ディレクトリ/.git/

初期化できた模様。

git fetch --unshallow
fatal: --unshallow on a complete repository does not make sense

上記記事をもとに、最後のメッセージからunshallowに問題ないことがわかった。
brew updateしたら問題なくアップデートできた。

brew update
Updated 2 taps (homebrew/core and homebrew/services).
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0