Macでlogrodate

install

brew install logrotate

適当にplistつくる

sudo nvim /Library/LaunchDaemons/logrotate.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>logrotate</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/sbin/logrotate</string>
    <string>/etc/logrotate.conf</string>
  </array>
  <key>Disabled</key>
  <false/>
  <key>RunAtLoad</key>
  <false/>
  <key>StartCalendarInterval</key>
  <dict>
    <key>Minute</key>
    <integer>0</integer>
  </dict>
</dict>
</plist>

下準備

mkdir /usr/local/var/lib/
sudo /usr/local/sbin/logrotate -f /usr/local/etc/logrotate.conf

起動

sudo launchctl load /Library/LaunchDaemons/logrotate.plist

停止

sudo launchctl unload /Library/LaunchDaemons/logrotate.plist

参考にした

Hosting Rails apps on a Mac OS X server – Jason Codes