Thursday, August 18, 2011

Apple clean up all tmp files, resets and diagnostics

I recently went through an exercise where I needed to totally clean up my MacBook Pro's hard drive to get it back to a clean and relatively known state without doing a reformat and reload of the OS.   Here are the steps I went through thanks, in great part, to a call into AppleCare on some things that were less than intuitive.  This is for my internal documentation, so please use at your risk....


Apple clean up all tmp files, resets and diagnostics

  1. # cd  /Library/Caches/; rm -fr *; cd ~dave/Library/Caches; rm -fr *

  2. boot in SAFE mode which will clean up a number of files
    1. To perform a Safe Boot, hold the Shift key as your Mac starts up.
    2. BOOT IN SAFE MODE FOR BEST TROUBLESHOOTING TO STOP UNNECESSARY PROGRAMS FROM STARTING UP

  3. Resetting the System Management Controller (SMC)
    1. On the built-in keyboard, press the (left side) Shift-Control-Option keys and the power button at the same time
    2. Release all the keys and the power button at the same time.

  4. Resetting PRAM and NVRAM
    1. Shut down the computer.
* Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.
* Turn on the computer.
* Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
* Hold the keys down until the computer restarts and you hear the startup sound for the second time.
* Release the keys.
* Your computer's PRAM and the NVRAM are reset to the default values. The clock
settings may be reset to a default date on some models.

5. CLEAR ALL BROWSER CACHES

6.  run the Apple Hardware Test
     
        Press and hold the "D" key before the gray startup screen appears.

7. Boot up using alternative boot partition either by going into settings and changing the boot sector or by HOLDING down the OPTION key when booting to select



Intel-based Macs: Using Apple Hardware TestNote: Please be sure to disconnect any external devices, printers, hard drives, scanners, and so on (other than the Apple keyboard and mouse) from your Apple Computer before starting up to Apple Hardware test and running the Diagnostic.

To start up your computer in Apple Hardware Test:

  1. If the computer is already on, insert the appropriate disc into the optical disc drive, then restart. If the computer is not on, turn it on and insert the disc as soon as possible after startup.
  2. Press and hold the "D" key before the gray startup screen appears.
  3. It takes a minute or so for Apple Hardware Test to start up and inspect your hardware configuration. While this is taking place, an icon appears on the screen:
 When the process is complete, select your language and click the right arrow. If you aren't using a mouse, you can use the up and down arrows to select a language and then press the Return key.
  4. The Apple Hardware Test console appears. You can choose which sort of test or tests to perform:
      * To perform all of the basic tests, click the Test button or press the "T" key or the Return key.
      * To perform a more thorough diagnostic test, select the "Perform extended testing" checkbox under the Test button before you click the Test button.
Your test results will appear in the window in the bottom-right of the console.
The Hardware Profile tab of AHT provides specific information about your computer. To see this information, click the tab, then select a subject area on the left.

To exit AHT, click Restart or Shut Down at the bottom of the window. Remember that clicking Shut Down will not automatically eject the disc.   Resetting the System Management Controller (SMC)Note: Portable computers that have a battery you should not remove on your own include MacBook Pro (Early 2009) and later, all models of MacBook Air, and MacBook (Late 2009).

  1. Shut down the computer.
  2. Plug in the MagSafe power adapter to a power source, connecting it to the Mac if its not already connected.
  3. On the built-in keyboard, press the (left side) Shift-Control-Option keys and the power button at the same time.
  4. Release all the keys and the power button at the same time.
  5. Press the power button to turn on the computer.  Note: The LED on the MagSafe power adapter may change states or temporarily turn off when you reset the SMC.

Apple Resetting PRAM + NVRAM


Resetting PRAM and NVRAM

  1. Shut down the computer.
  2. Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.
  3. Turn on the computer.
  4. Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
  5. Hold the keys down until the computer restarts and you hear the startup sound for the second time.
  6. Release the keys.
  7. Your computer's PRAM and the NVRAM are reset to the default values. The clock settings may be reset to a default date on some models.


Contents of PRAM

Some Macintosh computers may not have all the settings described below. For Mac OS X information, refer to Mac OS X: What's Stored in PRAM?

Status of AppleTalk
Serial Port Configuration and Port definition
Alarm clock setting
Application font
Serial printer location
Autokey rate
Autokey delay
Speaker volume
Attention (beep) sound
Double-click time
Caret blink time (insertion point rate)
Mouse scaling (mouse speed)
Startup disk
Menu blink count
Monitor depth
32-bit addressing
Virtual memory
RAM disk
Disk cache


Safe BootSafe Boot is a special way to start up when troubleshooting. Safe Mode is the state Mac OS X is in after a Safe Boot. To perform a Safe Boot, hold the Shift key as your Mac starts up.

Products AffectedMac OS X 10.3, Mac OS X 10.2, Mac OS X 10.4, Mac OS X 10.6, Mac OS X 10.5, Time Capsule

Starting up into Safe Mode does several things:

   * It forces a directory check of the startup volume.
   * It loads only required kernel extensions (some of the items in /System/Library/Extensions).
   * In Mac OS X v10.3.9 or earlier, Safe Mode runs only Apple-installed startup items (such items may be installed either in /Library/StartupItems or in /System/Library/StartupItems; these are different than user-selected account login items).
   * It disables all fonts other than those in /System/Library/Fonts (Mac OS X v10.4 or later).
   * It moves to the Trash all font caches normally stored in/Library/Caches/com.apple.ATS/(uid)/ , where (uid) is a user ID number such as 501 (Mac OS X v10.4 or later).
   * It disables all startup items and login items (Mac OS X v10.4 or later).
   * Mac OS X v10.5.6 or later: A Safe Boot deletes the dynamic loader shared cache at (/var/db/dyld/). A cache with issues may cause a blue screen on startup, particularly after a Software Update. Restarting normally recreates this cache.
Taken together, these changes can help resolve software or directory issues that may exist on the startup volume.

Some features don't work in Safe ModeSafe Mode can be useful for troubleshooting. However, certain Mac OS X features do not work in Safe Mode. For example, you can't use DVD Player, capture video in iMovie, use audio input or output devices, or use an internal or external USB modem. The behavior of some devices such as an AirPort card may vary depending on computer and Mac OS X version.

Safe Mode in Mac OS X v10.5 or later also disables Quartz Extreme (hardware accelerated graphics). Applications that depend on Quartz Extreme will not open, and the Mac OS X menu bar will appear solid even if "Translucent Menu Bar" is enabled in Desktop & Screen Saver preferences.
Safe Mode in Mac OS X v10.6 or later also disables File Sharing access. This means you will not be able to mount Time Capsule disks or volumes being served by other computers running Mac OS X.

Additional InformationSee also: Mac OS X: Gray screen appears during startup