Using PlistBuddy to customize syslogd
# Inspired by: http://www.maciverse.com/the-case-of-the-slow-mac-and-how-to-fix-it.html # cf. man syslog, man syslogd and http://developer.apple.com/documentation/Darwin/Reference/ManPages/man8/syslogd.8.html /usr/bin/open -a Console # system.log /usr/bin/tail -n 50 /private/var/log/system.log help declare declare -x sudo=/usr/bin/sudo plistbuddy=/usr/libexec/PlistBuddy defaults=/usr/bin/defaults /usr/bin/env | /usr/bin/grep -E 'sudo=|plistbuddy=|defaults=' # create a symbolic link (on Mac OS X 10.4) help test /usr/bin/locate PlistBuddy if [[ ! -e /usr/libexec/PlistBuddy ]]; then $sudo /bin/ln -s "/Library/Receipts/AdditionalEssentials.pkg/Contents/Resources/PlistBuddy" /usr/libexec/PlistBuddy; fi # make a backup $sudo /bin/cp -p /System/Library/LaunchDaemons/com.apple.syslogd.plist /System/Library/LaunchDaemons/com.apple.syslogd.plist.orig # cf. http://developer.apple.com/documentation/Darwin/Reference/ManPages/man8/PlistBuddy.8.html $plistbuddy -h $plistbuddy -c Print /System/Library/LaunchDaemons/com.apple.syslogd.plist $plistbuddy -c "Print :ProgramArguments" /System/Library/LaunchDaemons/com.apple.syslogd.plist # compare $defaults read /System/Library/LaunchDaemons/com.apple.syslogd $defaults read /System/Library/LaunchDaemons/com.apple.syslogd ProgramArguments $sudo /usr/bin/nano /System/Library/LaunchDaemons/com.apple.syslogd.plist $sudo $plistbuddy -c "Delete :ProgramArguments" /System/Library/LaunchDaemons/com.apple.syslogd.plist $sudo $plistbuddy -c "Add :ProgramArguments array" /System/Library/LaunchDaemons/com.apple.syslogd.plist $sudo $plistbuddy -c "Add :ProgramArguments:0 string '/usr/sbin/syslogd'" /System/Library/LaunchDaemons/com.apple.syslogd.plist $sudo $plistbuddy -c "Add :ProgramArguments:1 string '-c'" /System/Library/LaunchDaemons/com.apple.syslogd.plist $sudo $plistbuddy -c "Add :ProgramArguments:2 integer 3" /System/Library/LaunchDaemons/com.apple.syslogd.plist # Mac OS X 10.5 #$sudo $plistbuddy -c "Add :ProgramArguments:3 string '-a'" /System/Library/LaunchDaemons/com.apple.syslogd.plist #$sudo $plistbuddy -c "Add :ProgramArguments:4 string '-db_max'" /System/Library/LaunchDaemons/com.apple.syslogd.plist #$sudo $plistbuddy -c "Add :ProgramArguments:5 integer 5000000" /System/Library/LaunchDaemons/com.apple.syslogd.plist $plistbuddy -c "Print :ProgramArguments" /System/Library/LaunchDaemons/com.apple.syslogd.plist $defaults read /System/Library/LaunchDaemons/com.apple.syslogd ProgramArguments $sudo /usr/bin/nano /System/Library/LaunchDaemons/com.apple.syslogd.plist # reset com.apple.syslogd.plist #if [[ -n $(/usr/bin/sw_vers -productVersion | /usr/bin/grep '^10.5') ]]; then exit; fi # exit if on Mac OS X 10.5.x $sudo /bin/rm -f /System/Library/LaunchDaemons/com.apple.syslogd.plist $sudo /bin/cp -p /System/Library/LaunchDaemons/com.apple.syslogd.plist.orig /System/Library/LaunchDaemons/com.apple.syslogd.plist $sudo /usr/bin/nano /System/Library/LaunchDaemons/com.apple.syslogd.plist # restart syslogd #$sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/com.apple.syslogd.plist 2>/dev/null #/bin/sleep 3 #$sudo /bin/launchctl load -w /System/Library/LaunchDaemons/com.apple.syslogd.plist 2>/dev/null #$sudo /usr/bin/killall -HUP syslogd # alternative