Fixing a stalled OSX software update

When I recently run Software Update on my MacBook Air I found it would stall at about the 10% mark during the "Checking for new software" phase. Below is a screenshot of what I mean by this:

A check of Activity Monitor showed that the problem was not caused by any network issue, in fact Software Update was not even trying to connect to the Internet. Fortunately this Apple support discussion page lead to the answer.

The problem appears to be caused by a corrupted, user-level software update cache file. To resolve delete the Cache.db file from your Library/Caches/com.apple.SoftwareUpdate directory. Once trashed repeat the software update process and all should be back to normal.

The discussion thread also discussed an interesting command line tool for performing OSX software updates. To perform a software update from the command line execute the following command (your password is required for sudo privileges):

sudo softwareupdate -i -a

This will run a fully automatic software update process, and once complete prompt you to restart the computer if required. Whilst a niche tool, it is a handy command to know about when performing remote OSX administration: