Mac Launch App As Root

Posted on by

Feb 26, 2020  A triangle to the left of an app's name means that the app consists of multiple processes. Click the triangle to see details about each process. Avg Energy Impact: The average energy impact for the past 8 hours or since the Mac started up, whichever is shorter. Average energy impact is also shown for apps that were running during that time, but. Now launch the Root Genius PC app and wait for a few minutes to detect your device by Root Genius app. Then accept the user agreement to install it. Now open the app and click on the 'Root it' button to start the rooting process. After that, the Android device will reboot automatically. The correct way to do this is request authorization for specific tasks or to log in as root. There is no reason any user land app should run with root privileges constantly. That just gives the user root and opens things for disaster. Both external and user blunder. – uchuugaka Jun 3 '14 at 6:53.

The Terminal is generally reserved as an environment for advanced configuration of your Mac, but there are those who resort to it on a regular basis and use it in conjunction with OS X’s graphical interface to make optimal use of the system. If you do so, then you might find yourself periodically wanting to launch an application, either directly from the command line, or from an automated action like a script. In addition, you can use this feature to launch multiple instances of a standard OS X program, or run it as a different user, such as root, which can give you access to the system in ways you might otherwise not have.

The classic way

As with general Terminal syntax, you can launch an executable script or binary file from the Terminal by simply entering its full path. However, to do so for an OS X app with a graphical interface, you will need to specify the app’s executable file within the application package. In most cases, this will be a subdirectory called /Contents/MacOS/ that contains an executable with the same name as the app. For instance, opening TextEdit in the Applications folder will require you run the following command:

This can be useful for troubleshooting problems with the program, since you will see console output (errors, warnings, and sometimes other activity) output directly to the Terminal window hosting the program, as opposed to having to use the Console utility.

If you would like to run the app as a different user (e.g., the root account), then you can first switch user accounts in the Terminal with the “su” command, or use “sudo” before specifying the path to the Mac OS application, and this will launch the program as root (note that this might not always work):

Keep in mind that launching a program in this way will launch a new instance of it, so if you have TextEdit already open, then you will see another TextEdit program open next to it. This has its benefits in some circumstances, but can interfere with services like Apple’s Resume feature (ie, it may overwrite your current window configuration so when TextEdit is quit, current window positions will not be saved and then restored when the program is next opened).

In addition, keep in mind that when opened in this manner, the Terminal window will be hosting the program, so it must remain open while the program is running—if you close the Terminal window, you will force-quit the program you have opened.

Using the “open” command

One of OS X’s unique Terminal commands is the “open” command that allows you to handle files, programs, and URLs in sometimes unique ways. The benefit of this program is, similar to using the Terminal for directly launching an app in the “classic” way; however, it does have two benefits. First, it is easier to use, and second, it does not require the Terminal remain open:

Examples: “SL-M2020W/XAA”. Removing epson printer software from mac computer

In this command, replace “appname” with the name of your desired app, and it should launch. Note that by default this command will, similar to the OS X graphical environment, only open one instance of an app, so if the program is already open then this command will switch to it. However, you can use this command to open another instance of the program, by adding the “-n” flag:

Keep in mind that as with the classic approach, multiple instances of an application running at the same time under the same user account may have odd consequences with supporting services that the application uses; however, for simple programs and utilities it can be useful to run another instance as root, in order to overcome permissions limitations with your current user account. Also consider apps like the Calculator, where it might be useful to have more than one calculation going at a time.

With the command run multiple times, you will open multiple instances of the program.


Launch GUI programs as root 19 comments Create New Account
Click here to return to the 'Launch GUI programs as root' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.

just use vi

wouldn't it have to be:
sudo open /path/to/application.app
I tried without the OPEN, and only received errors.
sudo open /applications/textedit.app
worked just fine.

No 'open' is required as the path digs into the actual app bundle; you'll need 'open' if you do it the way you listed..
-rob.

the hint doesn't say to use 'open'. should probably be fixed.
thanks
--peter

i misread rob's comment. call it an april fools' joke;)

This thread on the forum site contains much more complete information about launching GUI applications as root:
http://forums.macosxhints.com/showthread.php?s=&threadid=9872
The hint posted here only shows how to open a Cocoa application as root, but not a Carbon application. The forum thread will show you how to open both kinds of programs as root.
Also, if you have the system appearance set for 'Graphite' in the General system preference pane, then a GUI application launched as root will have an 'Blue' apple for the Apple Menu icon. This is the easiest way to distinguish between which applications were launched as root and which ones were launched as a normal user.

Very useful when trying out e.g. virus scanners. Presently, I am testing Norton beta v. 9, which refuses to scan some files unless run as root. The command: sudo /Applications/Norton Solutions/Norton AntiVirus.app/Contents/MacOS/Norton AntiVirus works

err, the backslashes escaping spaces disappeared when submitted, sorry about that. Perhaps without coding works better like this:
sudo /Applications/Norton Solutions/Norton AntiVirus.app/Contents/MacOS/Norton AntiVirus

Using quotes to escape backslashes is much more effecient (less keystrokes) for escaping spaces, not to mention being friendlier to GeekLog:
Backslashes
sudo /Applications/Norton Solutions/Norton AntiVirus.app/Contents/MacOS/Norton AntiVirus vs.
Quotes
sudo '/Applications/Norton Solutions/Norton AntiVirus.app/Contents/MacOS/Norton AntiVirus'

You can get a subtle indication of what's running as root and what not if you set root's colouring to the opposite of whatever you use. I use Graphite on the desktop, and root runs as Aqua; anything running as root will be in Aqua (such as Force Quit, as well as anything started as in this hint.)
I've been using this trick forever, since it's a relatively standard Unix thing. Sorry for not sharing.

That's kinda cool, but how did you change the color scheme for root? (Specifically, how can one do it without enabling the root account -- via sudo somehow?) Seems like it would be a good idea(TM) for Apple to implement this more generally: perhaps a nice red Apple menu icon in such circumstances..
Open System Preferences as root.

Mac Os Launch App As Root

lol
This shows you that the 'environment for sudo'd apps actually works like it's that user. Very cool.
BTW, IMHO, sudo open App.app is much cleaner than sudo App.app/Contents/MacOS/App . For one thing it won't open multiple copies of the same app, but instead open the existing running copy.

Agreed, except that opens System Preferences as user, not root; running the file the other way opens it as root.

I'm not sure why this is.

'sudo open' used to work for opening GUI apps, but this behaviour was changed to prevent people accidentally doing it..

the hint should read:
sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit &
it doesn't work as written

Mac Launch App As Root Download

I discovered, while I was writing this, that 'sudo open <filepath' won't launch as sudo. /me thinks it's because sudo executes an Apple app called 'open' that digs into the app package and opens the app. Problem is, the app doesn't get executed as root..only the package opener does. Not sure why that is the way it is, but this seems to work pretty well (for Cocoa apps..)
Someone asked on the channel a few days ago about launching the Finder as root (via this tip)
It -CAN- be done (maybe), but I'm not quite sure how, and I don't have an extra OS X machine to mess with (this old iMac is my primary and only X machine, so..) maybe when I get a new Tower, I'll have a few days to waste on getting a root Finder up and running.

Well this is basic, but I thank you all for it - the tip to change appearance of the root worked fine and is great, but I have another Q:
Is is possible to open an App as a different user than the current or root? For example if I want to just quickly change another users prefs or manage his iTunes Library?
I know 'su benny' then 'open -a iTunes' does not work, but is there not a workaround?

Is is possible to open an App as a different user than the current or root? For example if I want to just quickly change another users prefs or manage his iTunes Library?
I know 'su benny' then 'open -a iTunes' does not work, but is there not a workaround?

Try:
su - user
That should ensure that not only are you running as that user, but with that user's environment variables as well.
from man su:
-l Simulate a full login. The environment is discarded except for HOME, SHELL, PATH, TERM, and USER. HOME and SHELL are modified as above. USER is set to the target login. PATH is set to ``/bin:/usr/bin'. TERM is imported from your current environ- ment. The invoked shell is the target login's, and su will change directory to the target login's home directory. This option is identical to just passing '-', as in 'su -'.

Mac Launch App As Root Number

Usr bin Login

---
--------

Free clean and fix software on a mac. Hence, here are some of the positive and negative aspects of AVG Cleaner for Mac that we have observed. This best utility to clean Mac disk also helps you to remove log files and hidden cache. This one of the best free mac cleaners also offers a View & Clean feature to scan and remove junk files in a single click.However, before installing an application, we should also consider its pros and cons. AVG Cleaner for Mac is an entirely free mac cleaner software. It can even detect and delete duplicate files.


QA implies some sort of quality to begin with.