The Mac Observer

Skip navigational links

DealsOnTheWeb Daily Deal: 8GB iPod Touch: $229 Delivered

TMO Quick Tip - Repairing System Problems from the Command Line

by , 7:30 AM EDT, July 31st, 2006

If you suffer a system crash on your Mac, the battery accidentally drops out of your 'Book, or the power cord is unexpectedly yanked from your PowerMac or iBook, your computer may not start up and smoothly return you to your Desktop. Typically, I recommend Alsoft's DiskWarrior to repair any system damage and get you back on your feet. If you don't have a copy of DiskWarrior handy, however, you may need to resort to some Unix command line magic to get up and running.

Here's the disclaimer: Playing around with the Unix command line can be very dangerous if you don't know what you are doing. If you aren't comfortable mucking around in a place where you can delete everything on your hard drive with a simple command, find a friend that knows what they are doing, visit your local Mac User Group, or find a Mac consultant to help you out.

With that in mind, we're going to boot your Mac in single user mode and run the file system check command. Follow along, brave souls:

  • Start up your Mac.
  • As soon as you hear the startup chime, press and hold Command-S.
  • Wait until the gray startup screen goes away and you see white text scrolling down a black screen. Now you can release the keys.
  • Now you are in single user mode. With a little Unix know-how, you can do anything you want... Including deleting all of your files. Keep that in mind.
  • Type fsck -f and then press return. Spelling and capitalization count, so make sure you type everything correctly.
  • Your Mac should list off several things it is checking. If you get a message that says your file system appears to be okay, great! It's time to restart your Mac. If you get a message that says your file system was modified, you need to use the fsck -f command again.
  • Let's assume your Mac says everything is okay. Now it's time to restart your computer. Type shutdown -h now and press Return.
  • Once your Mac shuts down, go ahead and press the power button to turn it back on.

Many people use the reboot command instead of the shutdown command. That's perfectly fine. It saves you a few keystrokes when restarting your Mac, and you won't have to press the power button, either. I use the shutdown command because that's what I was taught to use when I first started fiddling around with Unix. The theory is that shutting down flushes everything from memory - eliminating any possible memory corruption. Old habits die hard.

If you prefer to use the reboot command, simply type reboot and then press Return.

One more thing: If you use a Bluetooth keyboard, be sure to keep a USB keyboard handy. You can't use a wireless keyboard to invoke special startup commands like Command-S.


if you have ideas for Mac related tips that you think other TMO readers might find helpful.

Observer Comments

Show: Subjects Only | Full Comments
Close Name:rsimonis Posts: 1 Joined: 31 Jul 2006
Subject: Additional Shutdown Option

You can also use "shutdown -r now". This will reboot without having to press the power button. It also eliminates the wait time for shutting down. Just a thought.

Close Name:stuartea Posts: 326 Joined: 08 Aug 2005
Subject:

You know, I hate the command line. I think what brought me to the Mac in the 80s was the total lack of command line. I'd been using computers with them before at school and home but it wasn't till I used a Mac that I finally 'got it' a computer that was powerful, that I understood and didn't have a friggin' command line : )

I'm sure the command line is powerful, and I've given it a go now and then, but, it's just really not for me. I'd only use it, if I really have no other choice.

(I'm being more generalistic and this is more about using it to fix your Mac)



Last edited by stuartea on Mon Jul 31, 2006 9:36 am; edited 1 time in total
Reply | Quote
Close Name:TheCiscoKid Posts: 2 Joined: 19 Nov 2003
Subject: bluetooth comment not true

if you have the latest version of 10.4, bluetooth keyboards should work fine in single user mode. i forget which update in particular changed this (I want to say 10.4.3?)

Close Name:Ibn Rushd Posts: 51 Joined: 16 May 2006
Subject: What is the difference

I have been using fsck -fy with the y appended, is that y necessary?

Close Name:jmincey Posts: 6 Joined: 12 Aug 2002
Subject: No Reboot is Necessary

A reboot is not necessary after performing the fsck -fy procedure. All you have to do (once you get word that your file system is okay) is to type "logout," press RETURN (or enter), and at this point Darwin will load all the GUI libraries and you will soon be presented with the standard Aqua user login window.

Jeff Mincey

Close Name:gopher Posts: 267 Joined: 28 Mar 2002
Subject: The most important thing to remember: backup

If you find yourself in a situation where starting in single user mode is necessary, or using any disk utility is necessary, be prepared for the possibility the problem may be worse than the disk utility can handle. Too often I've seen people depend on disk utilities to get themselves out of a jam, when they haven't backed up. Eventually all media fails to work in one way or another. It is not a question of if data will be lost but when. And hard drive failing symptoms can be identical to those you'd use Disk Warrior to solve. So only operate on an already backed up drive. See my FAQ for more info:

http://www.macmaps.com/backup.html

Close Name:deasys Posts: 243 Joined: 08 Apr 2003
Subject: This Tip Is Invalid for Panther and Tiger

By default Panther and Tiger implement file system journaling. That interferes with the normal fsck process. Just start up in Safe Mode instead:

http://docs.info.apple.com/article.html?artnum=106214
http://docs.info.apple.com/article.html?artnum=107250

BTW, as TheCiscoKid mentioned, Apple's Bluetooth keyboard will initiate and work in single-user mode just fine.

Close Name:Intruder -   TMO Mac Specialist Posts: 2835 Joined: 07 Jul 2004
Subject: Re: What is the difference

Quote
Ibn Rushd wrote:
I have been using fsck -fy with the y appended, is that y necessary?


The "y" just answers "yes" to the follow-on prompts, saving you the trouble.

View Name:Guest
Subject: gui in single user mode?
Comment on this Article


You cannot edit your comments.   You cannot delete your comments.
Log in | Register | Having Problems? Reset TMO Cookies & Try Again
Username:   Password:   Log me on automatically each visit   

You are not logged in, and this post will appear as "Guest." Log in with your username and password from the TMO forums. If you do not have a username, you can register here.
Please note that guests are limited to including a maximum of two URLs per post.


Post A Comment
  Subject


  Your Comments



Please enter the word exactly as you see it in the image above. Registered users aren't prompted for this. Having trouble reading the image get a new one.


Recent Headlines - Updated Monday, May 12th, 2008

Mon., 9:40 AM
iPodObserver - Rumor: New iPhones Now, Tablets at WWDC
9:15 AM
iPodObserver - SingTel Announces Singapore iPhone Deal
8:40 AM
Pixelmator 1.2 Draftsman Adds Rulers, Adjustments
8:15 AM
iPodObserver - iPhone Unavailable at US, UK Apple Store
8:00 AM
iPO Ted Landau's User Friendly View - In search of headphones for my iPhone
7:30 AM
iPO Quick Tip - iPhone: Saving SMS Messages to Your Mac
Fri., 6:00 PM
iPO Free on iTunes - Aussie UFOs, StrangeThings, Hometown Tales and More
5:30 PM
StrangeCharm - Fewer Particles, More Debris ( Week of May 5)
4:05 PM
MW: The New Rules for Buying a Mac
3:15 PM
OpenOffice 3.0 beta Released for Mac OS X
1:30 PM
Pogue: Time Capsule is So Simple, Just Ignore It
1:05 PM
C|Net: Why Apple Should Build a Game Console
10:45 AM
Hot Forum Topic - The iPhone's March Across the World
10:20 AM
Mailplane 2 Beta Includes OmniFocus Support
9:45 AM
iPodObserver - Apple Canada Offers $45 Credit in iPod Suit
9:05 AM
Apple Settles Power Adapter Suit
8:05 AM
Microsoft Dissolves Yahoo Proxy Board
7:30 AM
TMO Quick Tip - Tracking Application Updates in Dashboard
 

The Mac Observer Reader Specials

Apple Stock Quote

  • AAPL: $183.9401. Change Today: +0.4901.
  • (Prices delayed up to 20 minutes.)
  • Discuss in our Apple Finance Board

Hot Topics

Top Deals From DealsOnTheWeb