Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm debugging an Adobe Flash application my team and I have developed. Each time we update the application SWF files, we need to clear the browser caches. We also need to delete AssetCaches and setup a few other things.

So, I have a simple Bash script that deletes Firefox's file cache, Flash's shared objects, Flex's AssetCache, and Safari's Cache.db file. This is all fine, except not thorough. Safari still retains the previously loaded SWF files in memory cache. I believe Firefox is doing this also, but intermittently. This makes debugging a bit of a headache to say the least.

The work-around is to use each browser's GUI to clear their disc and memory caches. Just a bad work-flow all around. It would be awesome if I could add another line or two to my Bash script and wipe the memory cache along with the other tasks. How do I do this?

share|improve this question
up vote 1 down vote accepted

You just need to tell your browser that you cleared the cache. Either by restarting:

killall Safari
open -a Safari

Or by clearing the cache using GUI scripting, e.g. the following AppleScript:

tell application "Safari" to activate
tell application "System Events"
    tell application process "Safari"
        click (first menu item whose name is "Empty Cache…") of first menu of (first menu bar item whose name is "Safari") of first menu bar
    end tell
    keystroke return
end tell

You should be able to call it from your shell script using osascript name.scpt, or save as Application and open it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.