Software Update Related Scripts
softwareupdate -l
List all needed software updates.
softwareupdate -i someUpdateName
Install one specific update
softwareupdate -i -a
Installs all updates.
softwareupdate -l | grep Sec
List all needed Security updates (i.e., any update that contains the string "Sec")
tail -1 /Library/Logs/Software Update.log
Show the last software update installed. We use "tail -1" so there's only one line of output so we can scan the table easily. Of course you might just like to do "cat /Library/Logs/Software Update.log" to see all of them, in which case, don't forget to check Display All Output.
softwareupdate -l | grep Sec | awk 'length($1) == 1 {print $2}' | while read update; do
softwareupdate -i $update
done
Install all needed security updates. (This pipeline lists all the software updates, find the Security ones, and installs only those.)
if who | grep console; then
echo Machine is in use
exit 1
fi
# Set this environment variable
# to keep the QuickTime dialog from coming up
COMMAND_LINE_INSTALL=1 softwareupdate -i -a
shutdown -r now
Install all needed updates - but first, we check to see if the machine is in use and exit if it is; otherwise, we set the magic COMMAND_LINE_INSTALL variable to keep the QuickTime installer dialogue from coming up, then install all the updates, then reboot. |