Ok. Sometimes even the best computers crash. They’re still too primitive for the complexity we push on them. Poor things.

Poor us.

Here’s a script that helps clean up the mess left over from a system crash in Mac OS X (10.2). The script first checks your harddrive and attempts to repair it, then asks you if you want to delete old swap files (virtual memory), and cache files scattered around your system. This script has only been used with Jaguar! You could really damage your system if you use this on some other platform.

Please note: You must have administrative privileges on your Mac in order to install this script.


  • order levitra
  • order lexapro
  • order lioresal
  • order lipitor
  • order liquid rx plus
  • order lopressor
  • order lotensin
  • order mevacor
  • order multi vitamin
  • order neurontin
  • order nexium
  • order nolvadex
  • order norvasc
  • order pamelor
  • order paxil
  • order plavix
  • order pravachol
  • order premium diet patch
  • order prevacid
  • order prilosec
    1. Download the CrashCleaner script.
    2. If your browser did not do so automatically, decompress the downloaded file using Stuffit Expander. You should have a new file called CrashCleaner.sh
    3. Decide where you want the script to live. If you have no clue where to put it, put it in the Library/Scripts folder of your home directory. If you’re a UNIX geek, you might put it in /etc.

      The rest of this example assumes you will put it in your Library/Scripts folder.

    4. Move your decompressed file (CrashCleaner.sh) into the Library/Scripts folder in your user directory. If, when you open the Library directory of your home folder, you notice that you don’t have a Scripts folder, feel free to create one.

      If you open CrashCleaner.sh to check it out, DON’T hit save!!!. The script needs to have UNIX line endings. If you open up the script in a text editor, or word processor, it will be given Mac line endings, and if you subsequently save the file, the script will fail. If you want to examine the script to make sure it doesn’t do anything nefarious, just DON’T save it afterwards, or make sure to save it with UNIX line endings (from within, for example, BBEdit). Of course, if you’re using BBEdit, you probably don’t need these instructions.

    5. Now open your “Terminal” Application (/Applications/Utilities/Terminal). At the blinking prompt type:
      chmod 700 ~/Library/Scripts/CrashCleaner.sh
      and hit return. This will allow only you and the system itself to run this script.
    6. Exit your Terminal session by typing exit at the prompt, hitting return, and then quitting the application.

    Your system is now set up! The next time your computer crashes, just restart. After the ‘bong’ sounds, hold down Cmd-s (command-s). Once the text stops spurting by and you have a command prompt, simply type the location of your script (/Users/yourusername/Library/Scripts/CrashCleaner.sh), and it hit return, and crash cleanup will begin.


    One Comment to “CrashCleaner.sh: Repairs hard drive(s), deletes cache and swap files to help recover from Mac OS X crashes”  

    1. 1 Kristofer

      CrashCleaner.sh has been completely superceded by the much more fully featured and developed AppleJack, now at version 1.2 over at Sourceforge. It includes an installer and much improved code.
      http://applejack.sourceforge.net