How to Clear Safari Browser Cache on Mac: All Methods Explained
Clearing the Safari cache removes locally stored copies of web resources — images, scripts, stylesheets, and API responses — that Safari accumulates to speed up repeat page loads. When this data becomes stale or corrupted, it causes rendering glitches, login loops, outdated page content, and sluggish performance. Clearing the cache forces Safari to fetch fresh data from origin servers, resolving most of these issues immediately.
This guide covers every available method to clear Safari's cache on macOS, including the Developer menu shortcut, the Preferences-based full data wipe, the keyboard shortcut, and manual filesystem deletion — with technical context for when each approach is appropriate.
What Safari Caches and Why It Matters
Safari maintains several distinct storage layers on disk, and understanding them helps you choose the right clearing method:
- Disk cache (
com.apple.Safari/WebKitCache): Raw HTTP response data — HTML, CSS, JavaScript, images, fonts. This is what "Empty Caches" targets. - Cookies (
Cookies/Cookies.binarycookies): Session tokens, persistent login state, tracking identifiers. - LocalStorage / IndexedDB: Client-side application state stored by web apps (e.g., Gmail drafts, shopping cart contents).
- Service Worker cache: A programmable cache layer used by Progressive Web Apps (PWAs). This is separate from the HTTP disk cache and is not cleared by the Developer menu's "Empty Caches" command — a critical distinction most guides miss.
- DNS cache: Handled at the OS level, not by Safari directly.
Knowing which layer is causing your problem determines which method to use.
Comparison of Safari Cache-Clearing Methods
| Method | Clears Disk Cache | Clears Cookies | Clears History | Clears LocalStorage | Clears Service Worker Cache | Requires Developer Menu |
|---|---|---|---|---|---|---|
| — | — | — | — | — | — | — |
| Develop > Empty Caches | Yes | No | No | No | No | Yes |
| Option + Cmd + E shortcut | Yes | No | No | No | No | Yes |
| Safari > Clear History | Yes | Yes | Yes | Yes | No | No |
| Manual filesystem deletion | Yes | No | No | No | No | No |
| Safari > Settings > Privacy > Manage Website Data | No | Yes | No | Yes | Yes | No |
Use this table as a decision matrix before choosing a method. If you are debugging a PWA or a site using Service Workers, none of the standard cache-clearing options will fully reset the state — you must use Manage Website Data or the Web Inspector's Application tab.
Method 1: Clear Cache via the Developer Menu
The Developer menu is the fastest way to flush Safari's HTTP disk cache without touching cookies, saved passwords, or browsing history. This is the correct approach when a page is serving stale assets but your session and login state should be preserved.
Step 1: Enable the Developer Menu
- Open Safari.
- Click Safari in the menu bar, then select Settings (macOS Ventura and later) or Preferences (macOS Monterey and earlier). You can also press
Cmd+,. - Navigate to the Advanced tab.
- Check the box labeled Show Develop menu in menu bar.
The Develop menu will now appear between Bookmarks and Window in the menu bar. This setting persists across reboots — you only need to enable it once.
Step 2: Empty the Cache
- Click Develop in the menu bar.
- Select Empty Caches.
Safari immediately purges the disk cache. No confirmation dialog appears and no restart is required. The operation is instantaneous regardless of cache size.
Technical note: On macOS, Safari's cache is stored at ~/Library/Caches/com.apple.Safari/WebKitCache/. The "Empty Caches" command calls the WebKit cache invalidation API directly — it does not simply delete files, which means it handles cache integrity correctly and avoids leaving orphaned index entries.
Method 2: Clear Cache, History, and All Website Data
Use this method when you need a comprehensive reset — for example, when troubleshooting persistent login issues, resolving cookie-related redirect loops, or preparing a browser profile for privacy-sensitive work.
Step 1: Access Clear History
- Open Safari.
- Click Safari in the menu bar.
- Select Clear History.
Step 2: Choose a Time Range and Confirm
A dialog box will appear with a dropdown menu offering four time ranges:
- Last hour
- Today
- Today and yesterday
- All history
Select the appropriate range and click Clear History.
This single action removes browsing history, the HTTP disk cache, cookies, and other website data for the selected period. It does not remove saved passwords (stored in iCloud Keychain), AutoFill data, or open tabs.
Edge case: If you select "Last hour" but a corrupted cache entry was written two hours ago, it will not be cleared. When in doubt, select "All history" for a complete reset.
Method 3: Keyboard Shortcut
Once the Developer menu is enabled, you can empty the cache at any time without navigating any menus:
Press Option + Command + E.
This is functionally identical to Develop > Empty Caches. It is particularly useful during active debugging sessions where you need to repeatedly flush the cache between page reloads. Combine it with Cmd + Shift + R (hard reload) to force Safari to re-fetch all resources from the server immediately after clearing.
Method 4: Manual Filesystem Deletion
Manual deletion gives you direct access to the cache directory, which is useful when:
- Safari is unresponsive or cannot be launched.
- You want to inspect cache contents before deleting.
- You are writing an automation script or performing system maintenance across multiple user accounts.
Steps
- Quit Safari completely. Use
Cmd+Qor confirm via Activity Monitor that no Safari processes are running. Deleting cache files while Safari is active can cause index corruption.
- Open Finder. In the menu bar, click Go > Go to Folder (or press
Cmd+Shift+G).
- In the input field, type the following path and press Return:
~/Library/Caches/com.apple.Safari- Inside this directory, you will find subdirectories including
WebKitCacheand potentiallyfsCachedData. Select all contents and move them to the Trash.
- Empty the Trash.
Important: Do not delete the com.apple.Safari directory itself — only its contents. Deleting the parent directory can cause Safari to lose its cache configuration and trigger a brief re-initialization on next launch, which is harmless but unnecessary.
For automation, the equivalent shell command is:
rm -rf ~/Library/Caches/com.apple.Safari/WebKitCache/Run this only when Safari is not running. You can verify Safari is closed before executing:
pgrep -x Safari || rm -rf ~/Library/Caches/com.apple.Safari/WebKitCache/Method 5: Remove Specific Website Data (Cookies, LocalStorage, Service Workers)
This method is often overlooked but is essential for clearing Service Worker caches and per-site LocalStorage — the two layers that standard cache-clearing methods miss entirely.
- Open Safari Settings / Preferences (
Cmd+,). - Go to the Privacy tab.
- Click Manage Website Data.
- Use the search field to find a specific domain, or click Remove All to wipe all stored website data.
- Click Done.
This is the only built-in Safari UI method that removes Service Worker registrations and their associated caches. If a Progressive Web App is behaving incorrectly after an update, this is the correct fix.
How Cache Clearing Relates to Web Server and Hosting Configuration
Cache behavior is a two-sided equation. Even after clearing Safari's local cache, a web server can instruct the browser to immediately re-cache content via Cache-Control and Expires headers. If you manage a website and your users are reporting stale content, the fix is on the server side — specifically, adjusting cache-control directives in your web server configuration or CDN settings.
On a VPS Hosting environment running Nginx, for example, you control caching behavior at the response header level:
location ~* .(css|js|png|jpg|woff2)$ {
expires 30d;
add_header Cache-Control "public, immutable";
}For development and staging environments where you need browsers to never cache responses, use:
add_header Cache-Control "no-store, no-cache, must-revalidate";If you are running a Dedicated Server and using a control panel like cPanel, these headers can be configured via .htaccess or directly in the Apache virtual host configuration. Pairing proper server-side cache headers with client-side cache clearing is the correct approach for resolving persistent caching issues end-to-end.
For sites secured with HTTPS — which affects how browsers handle cached resources, particularly with Strict-Transport-Security headers — ensure your SSL Certificates are valid and properly configured. An expired or misconfigured SSL certificate can cause Safari to refuse cached resources and display connection errors that mimic cache corruption.
If you manage multiple domains or subdomains, each with its own cache scope, keeping your Domain Registration and DNS records accurate ensures that cache-busting strategies (such as versioned asset URLs) resolve correctly across all environments.
Troubleshooting: When Cache Clearing Does Not Fix the Problem
If clearing the cache does not resolve your issue, work through this diagnostic checklist:
- Still seeing old content? The server may be returning a
304 Not Modifiedresponse based onETagorLast-Modifiedheaders. Use Safari's Web Inspector (Develop > Show Web Inspector > Network tab) and check the response status codes. A304means the server confirmed the cached version is current — the issue is on the server, not the browser. - Login loop persists after clearing cache? You likely need to also clear cookies. Use Method 2 or Method 5.
- PWA not updating? The Service Worker is serving cached assets. Use Method 5 (Manage Website Data) or open Web Inspector > Application > Service Workers and click "Unregister."
- Cache folder is empty but performance is still poor? The bottleneck may be network latency, DNS resolution time, or server response time — not the local cache. Use the Network tab in Web Inspector to identify the actual latency source.
~/Library/Caches/com.apple.Safaridoes not exist? On macOS Sonoma and later with Safari 17+, some cache paths have been reorganized under~/Library/Containers/com.apple.Safari/Data/Library/Caches/. If the standard path is empty, check this container path.
For macOS Sonoma and later, the correct manual path is:
~/Library/Containers/com.apple.Safari/Data/Library/Caches/Technical Key-Takeaway Checklist
Before clearing Safari's cache, identify the exact problem to select the right method:
- Use Develop > Empty Caches (
Option+Cmd+E) for stale visual assets without losing session state. - Use Safari > Clear History > All History for a full browser reset including cookies and history.
- Use Privacy > Manage Website Data for Service Worker cache, IndexedDB, and LocalStorage — especially for PWA issues.
- Use manual filesystem deletion only when Safari is fully quit; target
WebKitCachecontents, not the parent directory. - On macOS Sonoma+, check
~/Library/Containers/com.apple.Safari/Data/Library/Caches/if the standard cache path appears empty. - After clearing the client cache, verify server-side
Cache-Controlheaders are correctly configured to prevent immediate re-caching of stale content. - If you manage the web server, use versioned asset filenames (e.g.,
style.v2.css) as a cache-busting strategy that works regardless of client-side cache settings.
FAQ
Does clearing Safari's cache delete saved passwords?
No. Saved passwords are stored in iCloud Keychain, which is entirely separate from the browser cache, cookies, and browsing history. None of the cache-clearing methods described here affect your saved credentials.
Why does Safari's cache keep filling up quickly after clearing it?
Safari re-caches resources on every page visit according to the server's Cache-Control directives. High-traffic browsing, media-heavy sites, and web apps with aggressive caching policies will refill the cache within hours. This is normal behavior — the cache is functioning as designed.
Does "Empty Caches" in the Develop menu clear Service Worker caches?
No. The Develop menu's "Empty Caches" command targets only the HTTP disk cache (WebKit's resource cache). Service Worker caches are managed separately by the browser's Cache Storage API. To clear them, use Safari Settings > Privacy > Manage Website Data, or use the Web Inspector's Application panel to unregister specific Service Workers.
How do I clear the Safari cache on macOS Sonoma if the standard cache path is missing?
On macOS Sonoma and Safari 17+, the cache may be stored inside the app container at ~/Library/Containers/com.apple.Safari/Data/Library/Caches/. Navigate there using Finder's Go to Folder dialog or the terminal, and delete the contents of the WebKitCache subdirectory with Safari fully closed.
Can I automate Safari cache clearing on a schedule using macOS tools?
Yes. You can use launchd to schedule a shell script that runs rm -rf ~/Library/Caches/com.apple.Safari/WebKitCache/ (or the Sonoma container path) at defined intervals. Create a property list file in ~/Library/LaunchAgents/ with a StartCalendarInterval key. Ensure the job runs only when Safari is not active by adding a pgrep check to the script, as shown in the manual deletion section above.
