Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use LaunchCFMApp to run BBEdit Lite as root Apps
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...]
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[9,117 views]  

Use LaunchCFMApp to run BBEdit Lite as root | 9 comments | Create New Account
Click here to return to the 'Use LaunchCFMApp to run BBEdit Lite as root' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
use Pseudo
Authored by: kyngchaos on Oct 07, '02 11:57:29AM

Easy with Pseudo - just drag BBEdit (or any other app) onto Pseudo. The latest version (v1.2.3) even adds Launch Documents to smooth out the process - open Pseudo, start the app, optionally get admin password from keychain, quit Pseudo.



[ Reply to This | # ]
use Pseudo
Authored by: jeb on Oct 07, '02 12:21:03PM

Pseudo was always cranky for me. If I had BBEdit Lite in the Dock, and then I dragged the .app from /Applications to Pseudo, I found Pseudo would remove it from the Dock when I quit, and I would have to hunt it down again. That was true prior to my OS X 10.2 update, and I haven't bothered with Pseudo since. Have they corrected this?



[ Reply to This | # ]
CFMApp to run App as root--didn't work
Authored by: mantei on Oct 07, '02 02:48:32PM

I tried the suggestion for running BBEdit as root using CFMApp. The result was the message "alias: too dangerous to alias that".



[ Reply to This | # ]
Here's how I got it working...
Authored by: robg on Oct 07, '02 10:06:24PM
Hmm, worked fine for me, although I used a slightly different version of the command:
  alias bbroot "sudo /System/Library/Frameworks/
Carbon.framework/Versions/Current/Support/LaunchCFMApp[space]
/Applications/BBEdit\ Lite\ 6.1/BBEdit\ Lite\ 6.1\ for\ OS\ X"
This let me open and edit the httpd.conf file as my normal user ... nice to have this functionality back for Carbon apps. -rob.

[ Reply to This | # ]
CFMApp to run App as root--didn't work
Authored by: hysterion on Oct 08, '02 12:59:51AM
Ned... it works for me, in both 10.1.5 and 10.2.1, both in the original form with quotes, and in rob's form above with backslash escapes. (The backslashes arise naturally by dropping the BBEdit icon onto Terminal, but in my experience, submitting them to Geeklog is asking for trouble :-) Maybe you typed `alias' twice? So far as I can tell (by grepping the code: line 231 here, line 313 here), the only thing that would trigger your error message is if we try to alias something to `alias' (or `unalias') itself -- which of course would get us hosed. E.g.:
[localhost:~] fz% alias alias emacs
alias: Too dangerous to alias that.


[ Reply to This | # ]
bbedit is smarter than that
Authored by: bhines on Oct 07, '02 04:25:08PM

BBEdit (full version) authenticates you when you try to edit a root-owned file. It is really, really nice. Does the lite version not do that?

1. Open a root owned file.
2. Try to edit it.
--> BBEdit asks for your password.

no need to launch as root.



[ Reply to This | # ]
bbedit is smarter than that
Authored by: hysterion on Oct 08, '02 01:03:54AM

> Does the lite version not do that?

No, it doesn't. That's kind of the whole point ;-)



[ Reply to This | # ]
Will this work for Cocoa apps?
Authored by: GaelicWizard on Oct 07, '02 06:51:57PM

LaunchCFMApp is how OSX launches carbon apps, right? (I may be wrong) If so, then will this work for cocoa apps too? I use Pseudo myself, but it gets tedious when I have to actually find the app to drop on it. I would much prefer making an easy script (.command) that would go directly to my app as root.

on a slightly differant topic: What about AuthorizationTrampoline? is this only useable when writen into a program? or can we just use that so that the prefs are still stored in my home folder??
Thanx in advance



[ Reply to This | # ]
Will this work for Cocoa apps?
Authored by: hysterion on Oct 08, '02 01:39:11AM
Well, more precisely, LaunchCFMApp is how OS X launches CFM executables -- as opposed to Mach-O executables. Most (all?) Cocoa apps are Mach-O, but Carbon ones can be either. E.g.:
[localhost:Internet Explorer.app/Contents/MacOS] fz% file Internet Explorer
Internet Explorer: CFM binary

[localhost:Finder.app/Contents/MacOS] fz% file Finder
Finder: Mach-O executable ppc

The present trick is only needed for CFM apps; for Mach-O apps you can just call the executable directly. So you'd do
% sudo -b /path/to/LaunchCFMApp '/Applications/Internet Explorer.app/Contents/MacOS/Internet Explorer'
but simply,
% sudo -b /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder
As to AuthorizationTrampoline, I dunno...

[ Reply to This | # ]