新しいrailsアプリを作成しようとしたところ、bundle installでMySQL関係でエラーが発生
大事なデータもないので、いっそのことMySQLを再インストールすることにしました
どうしよう!困った時のMac上のMySQLのアンインストール&再インストール、動作確認手順
https://qiita.com/akiko-pusu/items/aef52b723da2cb5dc596
を参考にしようと、
$ 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: 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/js_native_api.h
/usr/local/include/node/js_native_api_types.h
...
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
のエラーが発生。言われた通り、
$ brew link node
Linking /usr/local/Cellar/node/13.11.0...
Error: Could not symlink bin/node
Target /usr/local/bin/node
already exists. You may want to remove it:
rm '/usr/local/bin/node'
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 doctor したらUnbrewed header files were found in /usr/local/include. と言われたから消そうとしたけど消せなかった話
https://qiita.com/rinimaruranran/items/2d8d930ad846fa41b9e6
を参考に、
$ 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
$ npm uninstall npm -g
$ rm -rf /usr/local/lib/node_modules/npm
と入力しました。しかし、
$ brew link node
Linking /usr/local/Cellar/node/13.11.0...
Error: Could not symlink share/doc/node/gdbinit
Target /usr/local/share/doc/node/gdbinit
already exists. You may want to remove it:
rm '/usr/local/share/doc/node/gdbinit'
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 node
Linking /usr/local/Cellar/node/13.11.0...
Error: Could not symlink share/doc/node/gdbinit
/usr/local/share/doc/node is not writable.
$ sudo brew link --overwrite --dry-run node
Would remove:
/usr/local/share/doc/node/gdbinit
/usr/local/share/doc/node/lldb_commands.py
/usr/local/share/man/man1/node.1
/usr/local/share/systemtap/tapset/node.stp
/usr/local/lib/dtrace/node.d
とエラーが発生したため、
$ rm -rf ファイル名
でファイル名を削除しました。しかし、
$ brew link node
Linking /usr/local/Cellar/node/13.11.0...
Error: Could not symlink share/systemtap/tapset/node.stp
/usr/local/share/systemtap/tapset is not writable.
のエラーが出たので、
Homebrewインストールのlinkエラーを修正する方法
https://wtnvenga.hatenablog.com/entry/2017/11/15/125430
を参考に
$ cd /usr/local/share/systemtap
$ sudo chown -R $USER tapset
$ brew link node
Linking /usr/local/Cellar/node/13.11.0... 7 symlinks created
$ brew doctor
Your system is ready to brew.
良かった解決です!