LoginSignup
12

More than 5 years have passed since last update.

Homebrewでインストールしまくったあいつらの正体を知りに行く

Last updated at Posted at 2016-01-09

結論

brew-list-v.sh
brew list | grep -v '^lib' | while read line; do
  echo -n ${line}$'\t'
  brew info $line | grep -P '^https?://' | head -n1
done | column -t -s $'\t' > brew-list.txt
brew-list.txt
atk                        https://library.gnome.org/devel/atk/
autoconf                   https://www.gnu.org/software/autoconf
automake                   https://www.gnu.org/software/automake/
autotrace                  http://autotrace.sourceforge.net
awscli                     https://aws.amazon.com/cli/
:

そこそこ便利。

背景

Homebrewは、OSX界じゃあデファクトスタンダードといった趣です。

ただ、最近 zplug でzsh上にplugin commandとして放り込んだほうが良いものも多々あるなァ、brewで何インストールしたっけな、とbrew listしたら絶望的な気持ちになりました。

brew_list.png
あらあらまぁまぁ。

最初は「見覚えあるなァ、こいつ」と思ったものにアタリを付けて、検索して調べて・・・とやってましたが、正直やってられません

brew info [formula] とすれば、各インストールの詳細も見れます。

が、
brew_info.png
詳細ったって・・・なァ・・・。

こういう時こそ軽めのシェル芸だな、と思ったので飛び出しましたるのが冒頭のシェルです。

fzf なり、 peco なりと組み合わせてもいいかも。

brew-list-openurl.sh
brew list | grep -v '^lib' | while read line; do
  echo -n ${line}$'\t'
  brew info $line | grep -P '^https?://' | head -n1
done |
  column -t -s $'\t' |
  fzf |
  awk '{print $2} |
  xargs -n1 --no-run-if-empty open

うーん、brewの整理、頑張ろ。

追記 2016-02-17

よくよく見たら、brewにはhomeというサブコマンドがあったのですね

brew-list-openurl.sh
brew list |
  fzf |
  xargs -n1 --no-run-if-empty brew home

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
12