When you don't have backup copies of your system files...

by Jacek Artymiak

A friend of mine deleted some system files while he was logged into his Mac OS X box as root. He didn't have backup copies, and he did not want to reinstall the whole system. Off we went to Apple Support and did a quick search. I did not hold my breath for an easy solution, but we were lucky this time. Fortunately for my friend, the files he removed were a part of the April 2002 Security Update and they have not been changed by other Security Updates since then. Within seconds the April 2002 Security Update package was on the Desktop. Here's what we did next:

  • Double-click on the .dmg.bin file and we had it unpacked on the Desktop.

  • Another double-click and the .img file was mounted on the Desktop.

  • Next, we opened a new Terminal window and did:

    cd /Volumes/Security\ Update\ April\ 2002/SecurityUpdateApr2002.pkg/Contents/Resources/

  • Next, we had to unpack the archive with:

    sudo pax -rvzf SecurityUpdateApr2002.pax.gz

  • Now it was only a matter of copying missing files from the newly created directories to the directory where my friend had some fun with rm.

I'm sure that Apple would not encourage you to play with Security Updates in that way, but it was an emergency. Do not count on such hacks to save you every time, but if you're stuck, some Unix trickery can help. Now, go and do those backups you've been planning to do since last summer!

Have you ever used Security Updates in non-standard ways? Share you experience with others...


2003-03-14 06:27:12
Heads You Win
Shortly after I got my Mac I was bitten by the case insensitive file system of OS X when I installed the Perl LWP::Client module from CPAN and it overwrote /usr/bin/head with /usr/bin/HEAD. Oops.

In that case fink saved the day for me. Installing the textutils package meant I at least had a working version of head I could put back into /usr/bin! Felt a bit of a fool though.

2003-03-14 14:26:44
re: Heads you Win
The head and tail commands in the fink textutils package are actually the GNU versions, which happen to have more features than the bsd ones Mac OS X ships with. For instance, you can't tail -f multiple files using bsd tail, but you can with gnu tail. So for the most part, you're probably better off with the ones from fink. However, I know a /lot/ of install scripts and the like rely on head and tail, and they're expecting the bsd ones to be /usr/bin/. If the gnu ones you put there behave differently, you could be asking for trouble. I'd suggest getting a head binary from another mac and putting it in /usr/bin/head, and keeping the gnu textutils head in /sw/bin where it belongs. If you want to always use the gnu ones (as I do) you should make sure all the /sw stuff is ealier in your $PATH. Thus eneth my discussion of textutils for today. Tune in next week, when we... oh nevermind.