Monday, September 22, 2008

Shane's Top Mac Troubleshooting Tips

(This was posted originally in January 2006 when running OS X 10.4.3, Tiger; it has been updated to address changes since Snow Leopard in 2009).

I’m no expert on this stuff, but due to the years of diagnosing and fixing Mac issues (since 1993 to be exact with my old Classic II) I’ve developed a few troubleshooting routines that I automatically run through when stuff starts acting weird. Of course, most of the tricks of the old classic pre-X days are useless now (unless troubleshooting for Classic, of course), but here are some helpful ideas for X (currently 10.6.2).

= Command key (might have an Apple on the key as well)
= Option key
= Shift key

[Complete List of Macintosh Keyboard Shortcuts - http://support.apple.com/kb/HT1343]

First, get to know these helpful “snags” (startup key sequences):

* Start up in Open Firmware: --O-F (more below)
* Reset parameter RAM: --P-R (zaps the PRAM - see also Open Firmware reset)
* Bypass startup volume: -- -Delete (gets to a new volume if your current one is busted)
* Open the Startup Manager: (pick the volume you want to start up from)
* Force Mac OS X startup: X or -X (start in OS X)
* Start up from an optical disc: C (force start from your CD or DVD drive)
* Eject optical disc: mouse, trackpad button, or hold down the eject button (at startup)
* Start up from a network server: N (if you have a network startup volume)
* Reset PowerBook screen: R (no clue)
* Start up in Target Disk mode: T (firewire two computers together and boot from the other)
* Start up in Safe mode: (more below)
* Start up in Verbose mode: -V (great for seeing what the startup problem is)
* Start up in Single-User mode: -S (more below)

Most of these key sequences are still valid for Classic OS boots also (pre-X), and most of these don’t work if an Open Firmware password has been set using either Terminal or Apple’s OFPW application. Using an OF password is a good idea, especially for notebooks that could get stolen (protect your data from thieves at least).

Backup, Backup, Backup

Before doing anything, learn to regularly backup your system. I backup every hour to another drive (using Time Machine). It’s always best to keep two backups if possible, but one is better than none. There are other good backup solutions available too, such as Carbon Copy Cloner and SuperDuper. Do a backup immediately before making any major changes to your system too!

Programs are a-crashin’

If you have apps that are crashing, not responding, or you’re getting kernel panics, this is a sign that something is amiss. Here are the beginning steps to take:

• Repair permissions using Disk Utility if you can (this should always be your first step). Always try to repair permissions from the startup volume itself. If that doesn’t work, startup from your Install Disc and repair permissions from the Install’s Disk Utility (see below).

• Try logging out and back in.

• Try creating a new account and see if the problem persists. If it goes away then the problem is likely with your Home folder.

• Try restarting (rebooting).

• Check the volume for file system errors. There are a few ways to do this. I usually boot into Single-User mode first (see above snag list); to run a file system check, at the prompt type:

# /sbin/fsck -fy

If errors were found, continue running the above command until they’re gone; then type:

# reboot

If no errors were found, continue booting normally by typing:

# exit

Of course, you can also boot from your OS X install disc (hold C while booting), Repair Permissions, and run Repair Disk in Disk Utility. If Disk Utility or fsck won’t do the trick, consider an emergency boot disc or another bootable volume (separate hard drive or partition) with TechTool Pro or Disk Warrior to repair the volume.

• If none of these steps solved your problem try what’s listed below.

Safe Mode ( while starting up)

Here’s what it does for you:

* Performs a directory check of the hard drive identical to clicking Repair Disk in the First Aid pane of Disk Utility.
* Ignores kernel extensions cache (/System/Library/Extensions.kextcache).
* Loads only required kernel extensions (/System/Library/Extensions).
* Runs only Apple-installed startup items (/Library/StartupItems and /System/Library/StartupItems).
* Loads only those fonts in /System/Library/Fonts (Mac OS X 10.4 or higher).
* Trashes all font caches stored in /Library/Caches/com.apple.ATS/user ID number (Mac OS X 10.4 or higher).
* Disables Login Items (Mac OS X 10.4 or higher).

Safe Mode is a limited mode which also allows one to install and uninstall software and kernel extensions, and Disk Utility will easily repair permissions while in Safe Mode. Also, a good troubleshooting step while in Safe Mode is to use the Finder to delete the following:

/Library/Caches/* (delete entire directory contents)
/System/Library/Caches/* (delete entire directory contents)
/System/Extensions.kextcache (delete only this file)

NOTE: This can also be done in Single-User mode (see below).

More Single-User Tricks (-S while starting up)

Much can be done in Single-User mode (not just running fsck). It’s basically the BSD command line, so you can mount volumes and do a variety of maintenance tasks if you’re Terminal savvy (er…you’re a UNIX geek). To learn more about these commands and what they do, Google it and find out!

Mount the volume:

# mount -uw /

Run the cron routine maintenance scripts:

# sudo periodic daily
# sudo periodic weekly
# sudo periodic monthly

Update the prebindiing:

# sudo update_prebinding -root / -force

Repair permissions:

# sudo diskutil repairPermissions /

Eliminate some startup, cache, and kernel extension problems:

# /sbin/mount -uw /
# cd /Library/Preferences
# rm com.apple.loginwindow.plist
# rm com.apple.windowserver.plist
# cd /Library/Caches
# rm -r *
# cd /System/Library
# rm Extensions.kextcache
# cd /System/Library/Caches
# rm -r *
# reboot

You could also install Applejack, which is a wonderful utility to automate many Single-User maintenance and troubleshooting tasks for you.

Open Firmware (--O-F while starting up)

One could do quite a bit of damage when booting into Open Firmware (basically the Mac version of BIOS), so stick strictly to these commands unless you really know what you’re doing.

You can check the current OF environment by typing:

> printenv

To reset the OF and reboot, at the prompt type:

> reset-nvram
> set-defaults
> reset-all

Sometimes, you’ll need to eject a disc when the usual methods (holding down the mouse, E, or Eject buttons) don’t work. In OF, do this:

> eject cd
> mac-boot

Another neat fact. OF is based on the old programming language called Forth, which was originally written by an astronomer named Charles Moore to control telescopes. Forth is unique in the way it handles math; one must think in RPN (Reverse Polish Notation). So to add 2 and 5 to get 7, at the prompt type:

> 25+
> 7

Hopefully by now, your problem is solved. If not, you’re going to have to jump in some place like Apple Support (especially Discussions) or MacFixit forums.

Other Resources

Lots are available online, but here are some great links:

http://delicious.com/sonicdeviant/macintosh+Troubleshooting%20

No comments: