Take the 2-minute tour ×

I am looking for a QuickSilver way of doing the following on Mac:

$ sudo vi /etc/php.ini

Is it possible for me to open a file using TextEdit as super user?

Edit: I already know about Terminal plug-in, and it's great. But, I was hoping to use TextEdit without typing full path of TextEdit.

share|improve this question
add comment

4 Answers

If you want to see that "Run a Text Command in Terminal" action as duffbeer703 shows, you'll have to add the Terminal plugin.

**Sorry, I didn't see that you wanted to run TextEdit instead of vi. In order to do that, do this:

Make a ~/bin folder (that's a folder named bin in your home directory).

Add ~/bin to your path by editing ~/.profile and adding the following two lines: PATH="~/bin:${PATH}" export PATH

Go into ~/bin and make a new file called TextEdit with the following line: sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit $1 &

Make that file executable by doing: chmod +x ~/bin/TextEdit

Now go back to QuickSilver and its "Run a Text Command in Terminal" thing and do the period thing to type in text, then type: TextEdit /etc/php.ini

A terminal will popup and ask for your sudo password. Once you put that in, TextEdit will pop up and let you edit as root.

There's probably an easier or cleaner way, but it does work.

share|improve this answer
+1 for the ~/bin idea. –  eed3si9n Jun 28 '09 at 4:13
Good idea. If the problem is actually that he wants to use a GUI editor, an editor with a cli like TextMate or SubEthaEdit would work great. –  duffbeer703 Jun 28 '09 at 14:19
add comment

It is possible.

Open Quicksilver, type "." and type "sudo vi /etc/php.ini"

Under Action you want to select "Run as Text Command in Terminal"

alt text

share|improve this answer
add comment

The "Process Manipulation Actions" plugin adds a "Launch as Root" action. You may need to enable the action after installing the plugin.

  1. Go to "Preferences", then open the "Actions" section.
  2. Ensure you are viewing actions by type, and have "All Actions" selected.
  3. Enter "Root" in the search box.
  4. "Launch as Root" should be one of the few (if not only) results. Enable the action by checking the checkbox in the first column.
share|improve this answer
add comment
up vote -3 down vote accepted

Here's what I ended up doing:

$ sudo chmod 777 /etc/phi.ini
$ sudo chmod 777 /etc/apache2/httpd.conf

Yes, give up on the idea of sudoing altogether.

Next, open /etc in Finder by opening Quciksilver, navigate to Macintosh HD and pressing Option + /. Double-click on php.ini from Finder to pick the application to open it with.

To make php.ini show up in Quicksilver, I added a Custom catalog to /etc with Include Contents set to Folder Contents and Depth set to 2.

Now, all I have to do after invoking Quicksilver is to type "phpini" (without period) or "httpd" and hit enter.

share|improve this answer
Dude... my sysadmin senses are tingling! Instead, why don't create a group called "admin", chown root:admin files, add youself to the group? why the 777 abuse? –  LiraNuna Jun 28 '09 at 8:56
Really bad idea. Read my answer and the other guy's answer. –  duffbeer703 Jun 28 '09 at 14:18
add comment

Your Answer


