Use LaunchCFMApp to run BBEdit Lite as root

Oct 07, '02 09:12:34AM

Contributed by: hysterion

So you'd like to edit system files in everyone's favorite free-beer editor, but you'd rather avoid the hassle of enabling the root account and logging into it? Unfortunately, a previous hint to do this was broken by Apple's October 2001 Security Update.

However! Don't despair! This sad state of affairs can be worked around by using LaunchCFMApp as follows. Put this line in your ~/.tcshrc (or in aliases.mine, if you're set up that way):

alias bbroot "sudo -b /System/Library/Frameworks/
Carbon.framework/Versions/Current/Support/LaunchCFMApp
[space]'/Applications/BBEdit Lite 6.1 for OS X'"
[Enter all on one line with no added spaces except replace [space] with an actual space character]

This defines a bbroot command which, when entered in later Terminal sessions, will launch a root BBEdit process. There, we can open, edit, and save root-owned files by all the usual GUI methods. (E.g., open files by dropping them onto the active dock icon. Preferences go in /var/root/Library, and should probably be adjusted to use Unix line breaks.)

[Editor's note: This method should be extendable to run any application as root...]

Comments (9)


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