LoginSignup
23
11

More than 5 years have passed since last update.

brew doctor したらUnbrewed header files were found in /usr/local/include. と言われたから消そうとしたけど消せなかった話

Posted at

背景

mysql 8.0を使っていたんですけど、
mysql 2.5で動いていたものが動かなくなってしまい詰まったので、
一度バージョンダウンしてみることに。

アンイストールしていって再度インストールしようとしても出来ず。
brew doctorをしてみました。

それから大量のwarningに悩まされる日々が始まったのでした。

エラー内容

$ 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/node/libplatform/libplatform.h
  /usr/local/include/node/libplatform/v8-tracing.h
  :
  (無限に続く)

試したこと

/usr/local/include内に消さなあかんファイルたちがおるよーって言われているので、
消してみることに。

$ rm -rf /usr/local/include/node/libplatform/libplatform-export.h

すると、

rm: /usr/local/include/node/libplatform/libplatform-export.h: Permission denied

パーミッションで怒られてしまいました。
これ以降、何しようにも最終的に権限がないと怒られてしまい、右往左往することに。

解決策

最強さんを使えばよかった。

$ sudo rm -rf /usr/local/include/node/libplatform/libplatform-export.h

フォルダごと消すときは、

$ sudo rm -R /usr/local/include/node

これでパスワードを求められるので、入力すれば解決。

結果

$ 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: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  node

まだwarningが残っているぅ。。
まあ無限にいたファイルたちは消えました。

追加で

調べた以下のコードを試してみると、

$ npm uninstall npm -g
$ rm -rf /usr/local/lib/node_modules/npm
$ brew link node

こうなりました。

$ brew link node
Linking /usr/local/Cellar/node/11.13.0... 
Error: Could not symlink lib/dtrace/node.d
Target /usr/local/lib/dtrace/node.d
already exists. You may want to remove it:
  rm '/usr/local/lib/dtrace/node.d'

To force the link and overwrite all conflicting files:
  brew link --overwrite node

To list all files that would be deleted:
  brew link --overwrite --dry-run node

おお、変わった変わった。
で、また色々やったんですけど、最終的には以下で。

$ brew link --overwrite --dry-run node
inking /usr/local/Cellar/node/11.13.0... 8 symlinks created

よっしゃ!
これで!!!

$ brew doctor
Warning: Broken symlinks were found. Remove them with `brew cleanup`:
  /usr/local/bin/npm
  /usr/local/bin/npx

ぐふう、、、。
次こそは、、。

$ brew cleanup
Pruned 2 symbolic links from /usr/local

$ brew doctor
Your system is ready to brew.

わあああああああああああああああああああああああああああああああ

終わりに

brew doctorというコマンドを使ったことがなかったので、とても便利だと気づきました。
brew使う時に困ったらガシガシ使っていきます。

23
11
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
23
11