How do I "replay" the "Caveats" section from a homebrew recipe

brew info mongodb will display it. If you make the changes suggested by the Caveats however, there may be other Caveats presented which will be more applicable to your actual situation.


To see all caveats of the currently installed formulas you can use the following command

brew info $(brew list)

You can also filter the output with awk to only get the caveats sections. (I am an awk newbie suggestions or edits are welcome)

brew info $(brew list) | awk '/^==> Caveats$/,/^[a-z][a-zA-Z0-9_+-]+: stable |^==> (Dependencies|Options)$/'

Another possibility is to use sed

brew info $(brew list) | sed '/==> Caveats/,/==>/!d;//d'

And to have a formatted output (bash)

for cmd in $(brew list); do 
  if brew info $cmd | grep -q Caveats; then
    echo "$cmd\n"; 
    brew info $cmd | sed '/==> Caveats/,/==>/!d;//d'; 
    printf '%40s\n' | tr ' ' -; 
  fi; 
done;

I created a brew external command for that: https://github.com/rafaelgarrido/homebrew-caveats

$ brew caveats zsh
==> zsh: Caveats
Add the following to your zshrc to access the online help:
    unalias run-help
    autoload run-help
    HELPDIR=/usr/local/share/zsh/helpfiles

You can also pass multiple formulas:

$ brew caveats rabbitmq mongodb
==> rabbitmq: Caveats
Management Plugin enabled by default at http://localhost:15672

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

To have launchd start rabbitmq at login:
  ln -sfv /usr/local/opt/rabbitmq/*.plist ~/Library/LaunchAgents
Then to load rabbitmq now:
  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.rabbitmq.plist
Or, if you don't want/need launchctl, you can just run:
  rabbitmq-server

==> mongodb: Caveats
To have launchd start mongodb at login:
  ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
Then to load mongodb now:
  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
Or, if you don't want/need launchctl, you can just run:
  mongod --config /usr/local/etc/mongod.conf

Pretty handy when you need to check some configs!

Tags:

Macos

Homebrew