かすみん日記

暇なときに何か喋ります

作業ログ:本日のbrew doctor

brew doctorの警告を消していく作業ログになります。

環境

  • macOS big sur v11.5.1
  • Homebrew 3.2.11
  • zsh

警告

たくさん警告が出ちゃった;

% 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: Some installed kegs have no formulae!
This means they were either deleted or installed with `brew diy`.
You should find replacements for the following formulae:
  protobuf@3.7

Warning: You have the following deprecated, cask taps tapped:
  caskroom/cask
Untap them with `brew untap`.

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  sdl
  sdl_image
  sdl_ttf
  sshfs

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /Users/hoge/.rbenv/shims/passenger-config

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/python3.6m/pygame/_camera.h
  /usr/local/include/python3.6m/pygame/_pygame.h
  /usr/local/include/python3.6m/pygame/_surface.h
  /usr/local/include/python3.6m/pygame/bitmask.h
  /usr/local/include/python3.6m/pygame/camera.h
  /usr/local/include/python3.6m/pygame/fastevents.h
  /usr/local/include/python3.6m/pygame/font.h
  /usr/local/include/python3.6m/pygame/freetype.h
  /usr/local/include/python3.6m/pygame/mask.h
  /usr/local/include/python3.6m/pygame/mixer.h
  /usr/local/include/python3.6m/pygame/pgarrinter.h
  /usr/local/include/python3.6m/pygame/pgbufferproxy.h
  /usr/local/include/python3.6m/pygame/pgcompat.h
  /usr/local/include/python3.6m/pygame/pgopengl.h
  /usr/local/include/python3.6m/pygame/pygame.h
  /usr/local/include/python3.6m/pygame/scrap.h
  /usr/local/include/python3.6m/pygame/surface.h

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  qt

ひとつずつ対処していきます!

1つめ:deleted formulae

Warning: Some installed kegs have no formulae!
This means they were either deleted or installed with `brew diy`.
You should find replacements for the following formulae:
  protobuf@3.7

protobuf@3.7はもう削除されたformulaらしい。

特に思い出もないのでアンインストールしようとしたけどダメだった;

% brew uninstall protobuf@3.7
Error: Refusing to uninstall /usr/local/Cellar/protobuf@3.7/3.7.1_1
because it is required by mysql, which is currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies protobuf@3.7

mysqlがこれに依存しているらしい。

mysqlはもう使ってないのでアンインストールする;

brew uninstall mysql

これは成功。 このあとbrew doctorしても先の警告は消えてなかった。

改めてprotobuf@3.7をアンインストール;

brew uninstall protobuf@3.7

普通に成功。brew doctorを確認すると警告は消えた。

2つめ:deprecated cask taps

Warning: You have the following deprecated, cask taps tapped:
  caskroom/cask
Untap them with `brew untap`.

cask tapsというのは、

brew tapとは公式以外のリポジトリをフォーミュラとしてHomebrewに追加するもので、brewのもとでinstall,uninstall,updateなどが行えます。

とのこと(参考)らしい。

実際、cask tapsを見てみるといくつか表示された;

% brew tap  
caskroom/cask
dersimn/craft
heroku/brew
homebrew/cask
homebrew/core
homebrew/services
ie-developers/ie

そのうちのcaskroom/caskがオワコンなのでuntapしろということらしい。

brew caskコマンドが使えなくなったのと関係があると思う。

とにかくuntap;

brew untap caskroom/cask

brew tapcaskroom/caskが消えていることが確認でき、brew doctorの警告も消えていた。

3つめ:deprecated formulae

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  sdl
  sdl_image
  sdl_ttf
  sshfs

sdlが何なのかはわからないが、新しいsdl2に置き換わったっぽい。

多分もう不要なのでアンインストールする;

brew uninstall sdl_image
brew uninstall sdl_ttf
brew uninstall sdl

同様にsshfsもアンインストール;

brew uninstall sshfs

4つめ:Homebrew管轄外のconfigファイル

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /Users/hoge/.rbenv/shims/passenger-config

PATHの中にHomebrewが管轄外の*-configという名前のファイルがあると衝突を起こすかもみたいな理由で警告が出ているようです。

対処法としては、brewコマンドを実行する際には管轄外の*-configファイルがあるディレクトリをPATHから消してやればよいとのことです。

brewコマンド実行時にPATHを設定し直すようなエイリアスを設定します。

zshなら~/.zshrcに、bashなら~/.bash_profileエイリアスを設定する;

# zsh
echo 'alias brew="env PATH=${PATH/\/Users\/hoge\/\.rbenv\/shims:/} brew"' >> ~/.zshrc

# bash
echo 'alias brew="env PATH=${PATH/\/Users\/hoge\/\.rbenv\/shims:/} brew"' >> ~/.bash_profile

${A//B/C}の部分は、変数Aをその中でパターンBにマッチした部分を文字列Cに置き換えて展開するというものです(シェルの変数展開)。

パターンの書き方は、*-configファイルのあるディレクトリが/Users/hoge/.rbenv/shims/であれば、スラッシュ/とドット.の前にバックスラッシュ\をおいてエスケープします。

今回は置換後の文字列が省略されているので、パターンにマッチした部分が消去されます。

エイリアスを設定したら、設定ファイルを際読み込みします;

source ~/.zshrc

(この後変な操作しちゃって因果関係が不明になっちゃったけど、多分これで直ったんだと思います)

参考:【Homebrew】brew doctorのWarning対処方法 (その3) + envコマンドについて - TASK NOTES

5つめ:Unbrewed header files

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/python3.6m/pygame/_camera.h
  /usr/local/include/python3.6m/pygame/_pygame.h
  /usr/local/include/python3.6m/pygame/_surface.h
  /usr/local/include/python3.6m/pygame/bitmask.h
  /usr/local/include/python3.6m/pygame/camera.h
  /usr/local/include/python3.6m/pygame/fastevents.h
  /usr/local/include/python3.6m/pygame/font.h
  /usr/local/include/python3.6m/pygame/freetype.h
  /usr/local/include/python3.6m/pygame/mask.h
  /usr/local/include/python3.6m/pygame/mixer.h
  /usr/local/include/python3.6m/pygame/pgarrinter.h
  /usr/local/include/python3.6m/pygame/pgbufferproxy.h
  /usr/local/include/python3.6m/pygame/pgcompat.h
  /usr/local/include/python3.6m/pygame/pgopengl.h
  /usr/local/include/python3.6m/pygame/pygame.h
  /usr/local/include/python3.6m/pygame/scrap.h
  /usr/local/include/python3.6m/pygame/surface.h

Homebrew管轄外のheaderファイルがあって衝突するかもという警告。

身に覚えがなければ消していいと思う。

消す;

rm /usr/local/include/python3.6m/pygame/*.h

これで警告は消えた。

6つめ:

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  qt

リンクする;

% brew link qt
Linking /usr/local/Cellar/qt/5.15.1... 510 symlinks created.

終わり。

以上

最期にbrew doctorすると、もう警告は出なくなった;

% brew doctor 
Your system is ready to brew.

お疲れさまでした。