Run OS X apps as root

Dave Feldman
2 min readAug 13, 2001

--

If you’ve used Mac OS X’s command line at all, you may have already seen the sudo command. It lets you execute commands as root (also known as the super-user), which you may want to do periodically for various UNIX system administration tasks. However, sudo can also be used to run any Mac OS X application as root.

This can be very useful: For example, if you want to edit a system configuration file in TextEdit or BBEdit, you’ll have to do so as root or you won’t be able to save changes.

sudo’s basic syntax is simple. Typing sudo myProcess at a command prompt runs myProcess as root. (If you haven’t used sudo in a while you’ll be prompted for your password first.)

You can run any app the same way, using sudo and the open command. Suppose you want to run the Chess application as root. Open Terminal (in Applications > Utilities) and at the command prompt, type:

sudo open "/Applications/Chess.app"

That’s it! You’re running Chess as root. A few things to note:

  • Some applications use the “.app” extension shown above, while others do not. You can figure out whether an app uses this extension in Terminal. Use the cd command to change to the appropriate folder (cd /Applications). Then type ls to see the folder’s contents.
  • The quotation marks aren’t actually necessary in the example above. However, they are necessary if any part of the filename or path contains spaces. For example, without quotation marks “/Applications/My Folder/My App” will be interpreted by the command line as three items rather than one.

The root user has unlimited power over the operating system. It’s relatively easy, with a few keystrokes, to erase massive amounts of data or render the system unusable. Letting root access fall into the wrong hands is, of course, also very dangerous. Every UNIX system administrator needs to become root from time to time, but you should always use extra caution, and only execute commands as root when absolutely necessary.

Originally published at operationproject.com on August 13, 2001.

--

--

Dave Feldman
Dave Feldman

Written by Dave Feldman

Multidisciplinary product leader in Berlin. Founder of Miter, Emu. Alum of Heap, Google, Meta, Yahoo, Harvard. I bring great products & teams to life.

No responses yet