3 Ways to Open Apps with Root Rights on Mac

Table of contents:

3 Ways to Open Apps with Root Rights on Mac
3 Ways to Open Apps with Root Rights on Mac

Video: 3 Ways to Open Apps with Root Rights on Mac

Video: 3 Ways to Open Apps with Root Rights on Mac
Video: How to disable password login from Macbook | Turnoff login screen from Mac 2024, November
Anonim

You can open any Mac application with root privileges, as long as you have the computer administrator password. However, use this root access as necessary, and be careful when using apps with root access. Careless use of applications or access rights can damage applications or your computer.

Step

Method 1 of 3: With an Administrator Account

Understand icon
Understand icon

Step 1. Know the risks of using root privileges

Most applications with graphical interfaces are not designed to handle root privileges. Limit the use of permissions to perform certain tasks that you fully understand. Reckless use of permissions can lock your access to some files, make applications unresponsive, or open security holes.

Open Applications With Root Privileges on a Mac Step 2
Open Applications With Root Privileges on a Mac Step 2

Step 2. Log in to an administrator account on your computer, then open a Terminal by clicking Applications → Utilities and selecting Terminal

Make sure the administrator account you are using is password protected. The terminal doesn't allow you to access root from an account that doesn't have a password

Open Applications With Root Privileges on a Mac Step 3
Open Applications With Root Privileges on a Mac Step 3

Step 3. Try the quick way to access root

The "sudo" command allows you to open applications with root privileges, but you must know the full address of the application's main file in the package. Most built-in and third-party Mac applications use a similar package system. Therefore, you can try the following command to open the application:

  • Enter sudo "\ the full address of the application package on the drive.app/Contents/MacOS/ application name ".

    For example, to open iTunes, enter sudo "/Applications/iTunes.app/Contents/MacOS/iTunes" and press Return.

  • Enter the password for the account you are currently using, then press Return.
  • If the command is successful, the application will open with root privileges. However, if Terminal displays a "command not found" error message, follow the next steps.
Open Applications With Root Privileges on a Mac Step 4
Open Applications With Root Privileges on a Mac Step 4

Step 4. Open the contents of the application package

If the quick method above doesn't work, find the app in the Finder, then right-click (or Control-click) the app icon and select Show Package Contents from the menu.

Open Applications With Root Privileges on a Mac Step 5
Open Applications With Root Privileges on a Mac Step 5

Step 5. Locate the program's main file

Now, you will see one or more folders in the application package. You can find the program's main files in this folder. Generally, these files are located in the /Contents/MacOS folder.

  • Generally, the program's main file has the same name as the program, but sometimes it has a different name, such as "run.sh".
  • The program's main file usually has a black box icon with a lowercase "exec".
Open Applications With Root Privileges on a Mac Step 6
Open Applications With Root Privileges on a Mac Step 6

Step 6. Enter the command sudo in Terminal, followed by a space

Don't enter the command first.

Open Applications With Root Privileges on a Mac Step 7
Open Applications With Root Privileges on a Mac Step 7

Step 7. Drag the main application file to the Terminal window

The full address of the application file will automatically appear in the Terminal window.

Open Applications With Root Privileges on a Mac Step 8
Open Applications With Root Privileges on a Mac Step 8

Step 8. Confirm the action by entering the password

Press Return, then enter the password for the account you are currently using. After that, press Return again. The application will open with root privileges.

Method 2 of 3: With a Non-Administrator Account

Open Applications With Root Privileges on a Mac Step 9
Open Applications With Root Privileges on a Mac Step 9

Step 1. Open Terminal with a non-administrator account to get started

Most system administrators prefer to use non-administrator accounts, to prevent serious computer damage caused by operating errors or malware attacks. This step will allow you temporary root access without switching accounts, but you'll still need an administrator password to do so.

Open Applications With Root Privileges on a Mac Step 10
Open Applications With Root Privileges on a Mac Step 10

Step 2. From Terminal, switch to administrator account

Enter the command su - followed by a space and the administrator username. After that, enter the administrator password. Now, you can use the administrator account in the terminal.

You don't really need to use the "-" sign in the command above. The flag serves to set the environment variable to the administrator account environment variable. Therefore, to prevent accidental damage to the computer, it is recommended that you use it

Open Applications With Root Privileges on a Mac Step 11
Open Applications With Root Privileges on a Mac Step 11

Step 3. Open the app with the "sudo" command

Generally, you can use the command sudo "\ complete address of application package on drive.app/Contents/MacOS/ application name ". If the command doesn't work, read the previous steps.

Open Applications With Root Privileges on a Mac Step 12
Open Applications With Root Privileges on a Mac Step 12

Step 4. When finished accessing root, return to the non-administrator account by using the exit command

After entering the command, Terminal will return to using the non-administrator account.

Method 3 of 3: Troubleshooting

Open Applications With Root Privileges on a Mac Step 13
Open Applications With Root Privileges on a Mac Step 13

Step 1. Disable System Integrity Protection by following these steps

This feature available since OS X 10.11 El Capitan restricts access to all files, even after you use a root account.. If you are unable to make the desired changes to the system, try disabling SIP. However, this step is very dangerous, and can damage the computer or the data on it. Therefore do this step only if you really understand the risks.

  • Restart the computer. When you hear the start sound, press and hold Command + R to enter Recovery Mode mode.
  • Select Utilities from the menu at the top of the screen, then click Terminal.
  • In the Terminal window, enter the command csrutil disable; reboots.
  • Wait for the computer to restart normally, then try the steps at the top of this article to open apps with full root permissions. When you're done using the app, consider re-enabling SIP. Follow the steps to disable SIP, but replace the disable command with enable.
Open Applications With Root Privileges on a Mac Step 14
Open Applications With Root Privileges on a Mac Step 14

Step 2. Use nano instead of a text editor with a graphical interface

Editing the configuration file with the text editor in Terminal may be a safer option. Nano is a built-in text editor that can be used from Terminal. To use nano with root privileges, use the command sudo nano, followed by a space and the file address. You will then be able to edit the file from within Terminal. When you're done editing the file, press Control + O to save the file, and Control + X to exit nano.

  • For example, the command sudo nano /etc/hosts will open the "hosts" file with root privileges.
  • We recommend that you back up the configuration file that you want to edit with the command sudo cp address)file_address file_backup. For example, to back up the "hosts" file with the backup name "hosts.backup", enter the command sudo cp /etc/hosts /etc/hosts.backup. If you made a mistake editing the file, rename it with the mv command (eg sudo mv /etc/hosts /etc/hosts.bad), and restore the backup with sudo cp /etc/hosts.backup /etc/hosts.

Tips

You only need to use quotation marks when writing the file address if the file address contains spaces

Recommended: