Create a GUI Finder with root access

May 14, '01 05:12:24PM

Contributed by: Anonymous

[Editor's note: I highly recommend that you do not use a root-enabled GUI Finder unless you really really know what you're doing. It's easy to do Very Bad Things to your system without truly intending to do so. With that warning, this is actually a fairly interesting trick. Use at your own risk, of course!]

I had to move around a bunch of files in the /usr directory and I really loathe using mv and cp in the CLI. It's so cumbersome! Of course, you can't drag-and-drop, because the user you're logged in as has no write privileges to /usr. There's a simple way around this, however.

Read the rest of this article if you're interested in creating a root-access Finder.

Open a Finder window in Column View. Type Command-Tilde or choose "Go To Folder" from the Go menu. In the sheet that comes down, type /System/Library/CoreServices. You'll see two Finders there. Click on one of them (just one click!) and make sure it doesn't say "Classic Application" in the preview pane. If it doesn't, then that's the one you want. Option-drag it to the desktop (because you want to duplicate it).

Now rename that app RootFinder or something. Move it to your /Applications directory. That's all the setup; the only part you have to repeat is from here on in.

Open the terminal. Type:

%> cd /Applications
%> sudo open -a RootFinder.app
(Note: the '%>' is the prompt; don't type that!)

Enter your admin password at the prompt. Note that your desktop picture will change, and a new default Finder window will pop up. Your original Finder windows or other running apps won't be affected, however. Now, you CANNOT move files from one Finder to the other, but as long as you're using only the root finder (opening new windows will open them as root finder, obviously), you have full root access to the bowels of your system and you can browse directories and copy/move files much more easily.

To get back to where you were, open the Terminal again. Type "ps auxc | grep Finder" and then "sudo kill [PID]" and enter the PID of the Finder. The Finder will automatically relaunch in your original account, and your desktop picture will change back.

According to my tests, this does not affect stability at all, but it boosts productivity considerably!

Enjoy,
gzl

Comments (10)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20010514171224297