Homebrewでエラーが出たらdoctorを呼ぶ

最近やっと私物マシンでMacPortsからHomebrewに移行しました。特にトラブルもなくホイホイpackageを入れまくってたんですが、突然こんなエラーが発生。

 % brew install tig
...
checking for iconv... no, consider installing GNU libiconv
configure: error: in `/private/tmp/brew-tig-1.0-pinS/tig-1.0':
configure: error: iconv() not found. Please install libiconv and use --with-libiconv=/path/to/dir.

(会社のマシンではtig入ったのにな。。)

/usr/libにはlibiconvが入っていたので、brew install tig --with-libconv=/usr/lib/ としても効果無し。んで本家のissuesを眺めていたところ、

iconv() not found error when brew install tig · Issue #1817 · mxcl/homebrew

brew doctorの結果見てみて〜とのコメント発見。実際に実行してみると、

% brew doctor
Warning: libiconv files detected at a system prefix other than /usr
Homebrew doesn't provide a libiconv formula, and expects to link against
the system version in /usr. libiconv in other prefixes can cause
compile or link failure, especially if compiled with improper
architectures. OS X itself never installs anything to /usr/local so
it was either installed by a user or some other third party software.

tl;dr: delete these files:
    /usr/local/include/iconv.h
...

どうやら何かのソフトウェアを入れた際に /usr/local/include/ にiconvヘッダが置かれたようで、削除したらうまくインストールできました。このエラーはdoctorが無いと気づけなかったな・・

brew関連の入門記事はざっとしか見てないんですが、doctorに関して言及されてるとこをあまり見かけなかったのでメモしときました。困ったときに覚えておくと便利ですね