Rescue Me: Keeping it all Running

By Graham K. Rogers

Last week I had one of those e-mails with the most simple of themes: help. Or rather, "Help!"

A local user, fairly new to Macintosh OSX had managed to lock himself out of his machine. OSX, being UNIX-based, is pretty hot on security. This is wonderful if, like me, you have 100 students to keep away from system files, or a local games-player who hasn't quite understood the importance of an application's settings. For the lone user this may be more of a hindrance.

When OSX is first set up, it asks for user names and passwords. If you are a little confused with this different approach, or if someone sets up the machine for you, it is easy to forget the password. No password, no computer.

It was at this stage, while the local user was in Europe, that I got the e-mail. Apple have fortunately realised that not all of us have eidetic memories, and they provide for the less well-equipped among us. Let me confess at this stage that the reason I was able to provide quick assistance was that I had also forgotten my password some months ago.

The key to getting out of this mess is on the installation disk. Put the disk into the computer and restart with the C key pressed. You should see the screen for installation of the operating system. Do not install; not unless you have a real reason for doing so. Instead, click on the Installer menu at the top of the screen. In that menu is "reset password". Enter the account name and a password. Do this twice for confirmation. Exit the Installer and restart.

For me, one of the joys of OSX has been the ability to play about with the command line again. I have not had so much enjoyment since MSDOS 6, or since the local ISPs went to total GUI. I used to love running Unix commands on the Internet; in the same way, Wanda Sloan's columns on writing batch files were so much fun. Now after all these years (seven I think), I can do it again.

It turns out that a couple of these commands are really quite useful in terms of rescue and maintenance.

Although OSX is touted as one of the most stable operating systems around, it does have occasional problems. Mine has crashed twice in 6 months; and a couple of programs have quit. As well as the standard Disk First Aid program, quite a few OSX users have found their way to the file system check which is built-in.

To run this utility, the computer has to be started up in single-user mode. At start up, hold down the Apple key and the S key. After a few moments the screen will go black, and white text will appear. This could be a nasty moment for some veteran Mac afficionados. If you want to see what this is like before taking the plunge, start up while holding down the Apple key plus the V key (verbose mode).

In single-user mode, once the text has finished scrolling, you are faced with a prompt. Enter the letters, fsck and leave one space, then type in -y for "yes."

fsck -y

Press enter and watch while the computer checks itself. If there is nothing wrong, you will be told that the computer "appears to be OK". Bland; but as good as you will get.

If there is something amiss, you will get a different message and you should run fsck -y again. I wait until I am told it is OK, then I run it one more time just to make sure.

As the operating system is Unix, there is some built-in maintenance. This runs during the night, if the computer is left running: not in sleep mode. If you do not want to keep your computer on all the time (mine has been on since January), there are other ways to do this regular maintenance.

The first is a program called Macjanitor and this is available from Versiontracker. It can be set up to do the housework automatically when the computer is on. Another way is to do it manually.

In the utilities folder is an application with the name, Terminal. Starting this gives you command line access. A normal user account will not have sufficient priviliges. Administrator access is needed.

At the prompt, type in sudo followed by a space. Then sh followed by another space. Lastly, type in /etc/daily and press enter. The whole is

sudo sh /etc/daily

You will then be asked for the password: keep it handy. When you press enter again, the computer goes through the clean-up routine that it would have done automatically if left to its own devices. It will take a couple of minutes.

As one might expect, there is also a routine for weekly maintenance, sudo sh /etc/weekly and this takes about 5 - 10 minutes.

There is a monthly routine too: sudo sh /etc/monthly which is brief at under 30 seconds.

Since writing the original article, I have found a third method, Macaroni, a small utility that appears in the system preferences. You can use this to run any regular unix command. The utility operates at the earliest time possible after the scheduled run.

Apple provides a utility that checks and fixes permissions: the ability to read, write or execute files. These sometimes get changed apparently, and for efficient operations it is good to get these right. The utility, Repair Permissions can be downloaded from the Apple website. A version can also be found on the Jaguar installation disk (along with the First Aid utility). Running this once in a while keeps everything tidy.

With earlier iterations of Mac operating systems, I relied heavily on Norton Disk Doctor. This does not appear to be successful with OSX and may indeed cause problems. A better recommendation is Disk Warrior.

There are two more things that I regard as conducive to system stability: I have reduced the use of Classic (System 9 run within OSX) to a minimum, rather than have it as a startup item; and I invested in a UPS (unlimited power supply) to avoid both infuriating power cuts and power fluctuations.

See also: An article on another rescue using Disk Warrior

For further information, e-mail to Graham K. Rogers.

Back to eXtensions
Back to homepage