How to Empty Cache in Safari for Mac OS X
Modern versions of the Safari web browser for Mac OS X offer a hidden feature that allows users to clear web caches from the browser without having to dump all other browsing history, cookies, searches, or other website data. This is a really useful feature for web workers and developers who routinely need to clear browser cache for pages and websites, which forces the browser to pull new data from the server(s) being accessed, but it can also be helpful for some troubleshooting situations in Safari as well.
In order to empty caches in Safari for Mac OS X, you’ll first need to enable the Develop menu in Safari from within the apps Preferences. This optional menu contains many developer centric features, including the ability to directly clear cache from Safari browsing sessions, which is what we’re going to focus on in this walkthrough.
How to Clear & Empty Safari Browser Caches in Mac OS X
As implied, this removes all web caches from Safari, and it can not be undone.
- Open Safari on the Mac
- If you haven’t done so already, choose to show the optional Develop menu by going to Safari menu in the upper left corner, choose Preferences > Advanced > “Show Develop menu in menu bar”, then close out of Preferences
- Back at any Safari browser window, pull down the “Develop” menu and choose “Empty Caches”
- Wait a few seconds and the Safari web caches will be cleared completely, allowing fresh web content to be pulled from the remote web servers without having any local cache serving for that session
There is no confirmation or alert dialog notifying the user that Safari browser caches have been cleared or emptied, it simply happens behind the scenes.
Empty Caches Keyboard Shortcut for Safari in Mac OS X: Command+Option+E
Once you have enabled the Develop menu, you will also gain access to a keystroke shortcut for clearing caches in Safari using Command+Option+E, which offers a faster method of access for users who need to access the feature often without having to pull down the menu every time.
Forcibly Refreshing Browser Caches for Specific Pages with Shift+Click
Users can also force refresh and reloading ignoring cache with a Shift+click on the Refresh page button in Safari for Mac if they need to clear cache for a specific page only. The advantage to this method is that it does not clear all other browser caches from Safari, it focuses on that specific page only. That can also be a disadvantage though, which is why many developers rely on the previously highlighted ‘clear all’ features instead.
Safari Cache File Locations in Mac OS X
For those who want to know where Safari cache files are stored locally within he file system, they’ll typically be in one of two locations in OS X, depending on what version of the OS is installed on the Mac.
Modern versions of Safari store browser caches locally at the following file system location in Mac OS X:
Most of the Safari caches are stored as a sqlite database file, and while you can manually browse through it, view cache entries, modify, delete entries, or remove the entire database file yourself, that’s generally not recommended unless you know exactly what you’re doing with a strong SQL background, compared to just using the Safari apps built-in Empty Cache function.
Note that older versions of Safari (pre 6) store the user cache files from the browser at the following location:
Again, while you can access the direct file system locations of the Safari cache files yourself, they are not intended to be user facing and thus are best cleared through the Develop menu and accompanying keyboard shortcut.
For most users, there is little need to clear out caches in Safari, but it can be a helpful troubleshooting trick for situations where the browser is not behaving as intended. In addition to emptying browser cache, clearing web history in OS X Safari and clearing all cookies, or removing site-specific cookies in Safari for Mac can also be helpful for remedying troublesome browser behavior. Some intermediate versions of Safari even included a reset option which did all of this in one fell swoop, but modern versions have since removed that ability for the time being, making users have to individually empty out site data in segmented chunks.
For those who enjoy digging behind the scenes of the Safari browser a bit with the developer menu, additional and more advanced options are also available through the hidden Debug menu as well, including a set of cache inspector tools.