It’s a good idea to run brew every day.
Instead of cron, I use launchd instead. launchd has better integration with system behavior, such as running scripts on system wake. (Admittedly, the XML syntax is quite horrid, but we’ll live with it.)
Create a local.custom.brew.plist file in ~/Library/LaunchAgents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
 
  <key>Label</key>
  <string>local.custom.brew</string>
 
  <key>ProgramArguments</key>
  <array>
    <string>brew</string>
    <string>update</string>
    <string>brew</string>
    <string>upgrade</string>
    <string>brew</string>
    <string>cleanup</string>
    <string>brew</string>
    <string>doctor</string>
  </array>
 
  <key>StartCalendarInterval</key>
  <dict>
      <key>Hour</key>
      <integer>00</integer>
      <key>Minute</key>
      <integer>00</integer>
  </dict>
 
</dict>
</plist>This will run brew update, brew upgrade, brew cleanup, and brew doctor at midnight every day.
#Load the .plist file
To load the .plist file, there are two options available:
launchctl
$ launchctl load ~/Library/LaunchAgents/local.custom.brew.plist
$ launchctl start local.custom.brew
lunchy
lunchy is a wrapper around launchctl:
$ gem install launchctl
$ lunchy restart local.custom.brew