Open a Root Finder Window in Snow Leopard or Later

This is an update to an existing post about the same topic. Yes, you can still open a root Finder window in Snow Leopard, but there is an extra step required.

First, run the following command in Terminal and then enter your password:

sudo /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder

Next, click on an empty spot on your desktop — not in an existing Finder window. Now, type Command-N  (⌘-N) or select New Finder Window from the File menu. A new Finder window resembling the following should open:

root-window

You can see that it opens up to the root user’s home. Use this window to navigate anywhere you like and make the changes you need. Keep in mind that you can do just as much damage with this as you can in the Terminal as root.

To end your root Finder session, go back to the Terminal window and hit ^C.

Quirks to be Mindful of

  • You won’t be able to interact with any files you might have on your desktop, as those belong to your logged-in user account and root’s desktop is currently (and transparently) sitting on top of it.
  • If you take any screenshots, they will be owned by the logged-in user and you’ll need to navigate to them via your root Finder window.
  • If you attempt to open/double-click a file which requires root access to read, the corresponding application will open as the logged-in user and the file will fail to open. To get around this, you can launch the app’s /Contents/MacOS executable as root and open the file from within the app.

Open a Finder Window with Root Access

UPDATE (9/28/09): Got Snow Leopard? Please see this post for updated instructions.

— — — —

It’s occasionally handy when troubleshooting a problem in OS X to have root access in the Finder without having to log out of your current session. Sure, you can do most things in the Terminal, but the GUI can be much handier for certain tasks. This is a quick-and-dirty Terminal trick to open a Finder window with root access.

Run the following command and then enter your password:

sudo /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder

A new Finder window resembling the following should open:

root-window

You can see that it opens up to the root user’s home. Use this window to navigate anywhere you like and make the changes you need. Keep in mind that you can do just as much damage with this as you can in the Terminal as root.

To end your root Finder session, go back to the Terminal window and hit ^C.

Quirks to be Mindful Of

  • You won’t be able to interact with any files you might have on your desktop, as those belong to your logged-in user account and root’s desktop is currently (and transparently) sitting on top of it.
  • If you take any screenshots, they will be owned by the logged-in user and you’ll need to navigate to them via your root Finder window.
  • If you attempt to open/double-click a file which requires root access to read, the corresponding application will open as the logged-in user and the file will fail to open. To get around this, you can launch the app’s /Contents/MacOS executable as root and open the file from within the app.

shotshadows – Quick Script to Enable or Disable Screenshot Shadows

If you’ve taken screenshots of windows in Tiger and Leopard using the command-shift-4+space trick, you’ll have noticed that Leopard will include the window’s (rather large) drop shadows in the resulting image. Depending on your point of view this can be good, bad, or a mixed blessing. I’m in the latter camp. They can be nice for blog posts, but if you’re creating documentation, for example, they can take up precious space on the page.

Using this hint as a starting point, I wrote the following bash script to make the process of disabling and enabling those shadows quick and painless:


#!/bin/bash
usage () {
/bin/echo "Usage: shotshadows [off|on]"
exit 1
}
if [ $# == 1 ]; then
if [ $1 == "off" ]; then
/bin/echo "Disabling drop shadows in screenshots and restarting SystemUIServer"
/usr/bin/defaults write com.apple.screencapture disable-shadow -bool true
/usr/bin/killall SystemUIServer
elif [ $1 == "on" ]; then
/bin/echo "Enabling drop shadows in screenshots and restarting SystemUIServer"
/usr/bin/defaults delete com.apple.screencapture disable-shadow
/usr/bin/killall SystemUIServer
else
usage
fi
else
usage
fi

view raw

shotshadows.sh

hosted with ❤ by GitHub

Save this script as shotshadows — or download it here — make it executable, and drop it somewhere in your path. (I use /usr/local/bin.) Now you can turn screenshot shadows on and off with the simple terminal commands shotshadows on and shotshadows off. The change takes effect instantly.