Edited at

brew doctorでWarningが出たので解決方法まとめました。(for Mac)


環境

Macbook pro(2017年モデル)

macOS Mojave


状況

Homebrewを使って、rbenvをインストールしようと試みたところエラーが発生し、


terminal

$ brew doctor


で確認したところ、以下のようなWarningが出現したので、その解決方法を備忘録として残しておきます。

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 dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
/usr/local/lib/libgvplugin_core.6.dylib
/usr/local/lib/libgvplugin_dot_layout.6.dylib
/usr/local/lib/libgvplugin_gd.6.dylib
/usr/local/lib/libgvplugin_neato_layout.6.dylib
/usr/local/lib/libgvplugin_quartz.6.dylib

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/arith.h
/usr/local/include/binary_log_types.h
/usr/local/include/cdt.h
/usr/local/include/cgraph.h
/usr/local/include/color.h
/usr/local/include/decode.h
/usr/local/include/demux.h
/usr/local/include/encode.h
/usr/local/include/errmsg.h
/usr/local/include/fcfreetype.h
/usr/local/include/fcprivate.h
/usr/local/include/fontconfig.h
/usr/local/include/freetype/config/ftconfig.h
/usr/local/include/freetype/config/ftheader.h
/usr/local/include/freetype/config/ftmodule.h
/usr/local/include/freetype/config/ftoption.h
/usr/local/include/freetype/config/ftstdlib.h
/usr/local/include/freetype/freetype.h
/usr/local/include/freetype/ftadvanc.h
/usr/local/include/freetype/ftbbox.h
/usr/local/include/freetype/ftbdf.h
/usr/local/include/freetype/ftbitmap.h
/usr/local/include/freetype/ftbzip2.h
/usr/local/include/freetype/ftcache.h
/usr/local/include/freetype/ftchapters.h
/usr/local/include/freetype/ftcid.h
/usr/local/include/freetype/ftdriver.h
/usr/local/include/freetype/fterrdef.h
/usr/local/include/freetype/fterrors.h
/usr/local/include/freetype/ftfntfmt.h
/usr/local/include/freetype/ftgasp.h
/usr/local/include/freetype/ftglyph.h
/usr/local/include/freetype/ftgxval.h
/usr/local/include/freetype/ftgzip.h
/usr/local/include/freetype/ftimage.h
/usr/local/include/freetype/ftincrem.h
/usr/local/include/freetype/ftlcdfil.h
/usr/local/include/freetype/ftlist.h
/usr/local/include/freetype/ftlzw.h
/usr/local/include/freetype/ftmac.h
/usr/local/include/freetype/ftmm.h
/usr/local/include/freetype/ftmodapi.h
/usr/local/include/freetype/ftmoderr.h
/usr/local/include/freetype/ftotval.h
/usr/local/include/freetype/ftoutln.h
/usr/local/include/freetype/ftparams.h
/usr/local/include/freetype/ftpfr.h
/usr/local/include/freetype/ftrender.h
/usr/local/include/freetype/ftsizes.h
/usr/local/include/freetype/ftsnames.h
/usr/local/include/freetype/ftstroke.h
/usr/local/include/freetype/ftsynth.h
/usr/local/include/freetype/ftsystem.h
/usr/local/include/freetype/fttrigon.h
/usr/local/include/freetype/fttypes.h
/usr/local/include/freetype/ftwinfnt.h
/usr/local/include/freetype/t1tables.h
/usr/local/include/freetype/ttnameid.h
/usr/local/include/freetype/tttables.h
/usr/local/include/freetype/tttags.h
/usr/local/include/ft2build.h
/usr/local/include/geom.h
/usr/local/include/graphviz_version.h
/usr/local/include/gvc.h
/usr/local/include/gvcext.h
/usr/local/include/gvcjob.h
/usr/local/include/gvcommon.h
/usr/local/include/gvconfig.h
/usr/local/include/gvplugin.h
/usr/local/include/gvplugin_device.h
/usr/local/include/gvplugin_layout.h
/usr/local/include/gvplugin_loadimage.h
/usr/local/include/gvplugin_render.h
/usr/local/include/gvplugin_textlayout.h
/usr/local/include/gvpr.h
/usr/local/include/lt_dlloader.h
/usr/local/include/lt_error.h
/usr/local/include/lt_system.h
/usr/local/include/mux.h
/usr/local/include/mux_types.h
/usr/local/include/my_command.h
/usr/local/include/my_list.h
/usr/local/include/mysql.h
/usr/local/include/mysql/client_plugin.h
/usr/local/include/mysql/plugin_auth_common.h
/usr/local/include/mysql/udf_registration_types.h
/usr/local/include/mysql_com.h
/usr/local/include/mysql_time.h
/usr/local/include/mysql_version.h
/usr/local/include/mysqld_error.h
/usr/local/include/mysqlx_ername.h
/usr/local/include/mysqlx_error.h
/usr/local/include/mysqlx_version.h
/usr/local/include/pack.h
/usr/local/include/pathgeom.h
/usr/local/include/pathplan.h
/usr/local/include/png.h
/usr/local/include/pngconf.h
/usr/local/include/textspan.h
/usr/local/include/types.h
/usr/local/include/usershape.h
/usr/local/include/xdot.h


解決法

まずは上のWarningから。(下のWarningも解決方法同じでした!!)

Warning: Unbrewed dylibs were found in /usr/local/lib.

If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
/usr/local/lib/libgvplugin_core.6.dylib
/usr/local/lib/libgvplugin_dot_layout.6.dylib
/usr/local/lib/libgvplugin_gd.6.dylib
/usr/local/lib/libgvplugin_neato_layout.6.dylib
/usr/local/lib/libgvplugin_quartz.6.dylib

①ターミナルに以下を入力します。(ファイルの作成)


terminal

$ vim ~/.del_files.sh


が並んだページが出現するので、1行目に#!/bin/bashを貼り付け、2行目以降にUnexpected dylibs:に記載されているファイルをコピペします。(以下、参考)


terminal

#!/bin/bash

/usr/local/lib/libgvplugin_core.6.dylib
/usr/local/lib/libgvplugin_dot_layout.6.dylib
/usr/local/lib/libgvplugin_gd.6.dylib
/usr/local/lib/libgvplugin_neato_layout.6.dylib
/usr/local/lib/libgvplugin_quartz.6.dylib

③カーソルを一番上のファイル(2行目)の頭におき、ctrl + vで矩形選択のビジュアルモード(VISUAL BLOCK)に移行。カーソルで一番下のファイルの頭まで選択し、:を押します。

すると、下のラインに既に :'<,'>が入力された状態でコマンドラインが表示されるので、続けて s/^/rm -f /と入力します。(rm は、ファイルやディレクトリを削除してあげるコマンドで、 -f は、「削除しますか?」的なメッセージを都度出さないようにするオプションです。)

Enterを押して、全ての行(一番上以外)の先頭にs/^/rm -f /が追加されているのを確認したら、もう一度:を押します。一番下の行に入力欄が出てくるので、wq!と入力し、Enterを押します。

⑤通常の入力モードに戻るので、そこで


terminal

$ bash ~/.del_files.sh


を実行。これでファイルが削除されます。

⑥以上が完了したら、


terminal

$ brew doctor


を実行し、エラー文が消えていたら、成功です。


追記

⑦もし、以下のようなWarningが出現した場合

Warning: Broken symlinks were found. Remove them with `brew cleanup`:

/usr/local/lib/libgvplugin_core.dylib
/usr/local/lib/libgvplugin_dot_layout.dylib
/usr/local/lib/libgvplugin_gd.dylib
/usr/local/lib/libgvplugin_neato_layout.dylib
/usr/local/lib/libgvplugin_quartz.dylib

エラー文に従って、


terminal

$ brew cleanup


してあげましょう。


こちらのWarningも上記と同じ方法で解決できます!!

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/arith.h
/usr/local/include/binary_log_types.h
/usr/local/include/cdt.h
/usr/local/include/cgraph.h
/usr/local/include/color.h
/usr/local/include/decode.h
/usr/local/include/demux.h
/usr/local/include/encode.h
/usr/local/include/errmsg.h
/usr/local/include/fcfreetype.h
/usr/local/include/fcprivate.h
/usr/local/include/fontconfig.h
/usr/local/include/freetype/config/ftconfig.h
/usr/local/include/freetype/config/ftheader.h
/usr/local/include/freetype/config/ftmodule.h
/usr/local/include/freetype/config/ftoption.h
/usr/local/include/freetype/config/ftstdlib.h
/usr/local/include/freetype/freetype.h
/usr/local/include/freetype/ftadvanc.h
/usr/local/include/freetype/ftbbox.h
/usr/local/include/freetype/ftbdf.h
/usr/local/include/freetype/ftbitmap.h
/usr/local/include/freetype/ftbzip2.h
/usr/local/include/freetype/ftcache.h
/usr/local/include/freetype/ftchapters.h
/usr/local/include/freetype/ftcid.h
/usr/local/include/freetype/ftdriver.h
/usr/local/include/freetype/fterrdef.h
/usr/local/include/freetype/fterrors.h
/usr/local/include/freetype/ftfntfmt.h
/usr/local/include/freetype/ftgasp.h
/usr/local/include/freetype/ftglyph.h
/usr/local/include/freetype/ftgxval.h
/usr/local/include/freetype/ftgzip.h
/usr/local/include/freetype/ftimage.h
/usr/local/include/freetype/ftincrem.h
/usr/local/include/freetype/ftlcdfil.h
/usr/local/include/freetype/ftlist.h
/usr/local/include/freetype/ftlzw.h
/usr/local/include/freetype/ftmac.h
/usr/local/include/freetype/ftmm.h
/usr/local/include/freetype/ftmodapi.h
/usr/local/include/freetype/ftmoderr.h
/usr/local/include/freetype/ftotval.h
/usr/local/include/freetype/ftoutln.h
/usr/local/include/freetype/ftparams.h
/usr/local/include/freetype/ftpfr.h
/usr/local/include/freetype/ftrender.h
/usr/local/include/freetype/ftsizes.h
/usr/local/include/freetype/ftsnames.h
/usr/local/include/freetype/ftstroke.h
/usr/local/include/freetype/ftsynth.h
/usr/local/include/freetype/ftsystem.h
/usr/local/include/freetype/fttrigon.h
/usr/local/include/freetype/fttypes.h
/usr/local/include/freetype/ftwinfnt.h
/usr/local/include/freetype/t1tables.h
/usr/local/include/freetype/ttnameid.h
/usr/local/include/freetype/tttables.h
/usr/local/include/freetype/tttags.h
/usr/local/include/ft2build.h
/usr/local/include/geom.h
/usr/local/include/graphviz_version.h
/usr/local/include/gvc.h
/usr/local/include/gvcext.h
/usr/local/include/gvcjob.h
/usr/local/include/gvcommon.h
/usr/local/include/gvconfig.h
/usr/local/include/gvplugin.h
/usr/local/include/gvplugin_device.h
/usr/local/include/gvplugin_layout.h
/usr/local/include/gvplugin_loadimage.h
/usr/local/include/gvplugin_render.h
/usr/local/include/gvplugin_textlayout.h
/usr/local/include/gvpr.h
/usr/local/include/lt_dlloader.h
/usr/local/include/lt_error.h
/usr/local/include/lt_system.h
/usr/local/include/mux.h
/usr/local/include/mux_types.h
/usr/local/include/my_command.h
/usr/local/include/my_list.h
/usr/local/include/mysql.h
/usr/local/include/mysql/client_plugin.h
/usr/local/include/mysql/plugin_auth_common.h
/usr/local/include/mysql/udf_registration_types.h
/usr/local/include/mysql_com.h
/usr/local/include/mysql_time.h
/usr/local/include/mysql_version.h
/usr/local/include/mysqld_error.h
/usr/local/include/mysqlx_ername.h
/usr/local/include/mysqlx_error.h
/usr/local/include/mysqlx_version.h
/usr/local/include/pack.h
/usr/local/include/pathgeom.h
/usr/local/include/pathplan.h
/usr/local/include/png.h
/usr/local/include/pngconf.h
/usr/local/include/textspan.h
/usr/local/include/types.h
/usr/local/include/usershape.h
/usr/local/include/xdot.h


参考URL

brew doctorでのWarningを解決してみた(for Mac)

HowTo: Save File in Vi / Vim Text Editor

server - E45 readonly option is set (add ! to override) - Ask Ubuntu