How to Open Applications With Root Privileges on a Mac

Download ArticleDownload Article

You can open any Mac application with root privileges, as long as you have an administrator password. As always, do not use root access unless you know what you are doing, as you could cause serious damage to the application or to your computer.

Things You Should Know

  • Root privileges lets you open any Mac application with an administrator password.
  • Using root privileges can damage your device if done incorrectly.
  • Limit yourself tasks you understand well to avoid damage to your applications and computer.
Method 1
Method 1 of 3:

From an Admin Account

Download Article
  1. How.com.vn English: Step 1 Know the risks.
    Most graphical applications are not designed for root access. Limit yourself to specific tasks you understand well, or you may end up with inaccessible files, application crashes, or security vulnerabilities.[1]
  2. How.com.vn English: Step 2 Open Terminal.
    Log into an administrator account on your computer. Go to ApplicationsUtilities and launch Terminal.
    • This administrator account must have a non-blank password, or Terminal will not allow you to access root privileges.
    Advertisement
  3. How.com.vn English: Step 3 Try the quick way.
    The sudo command lets you launch applications with root access, but it requires the path to the executable file within the application package. Most default Mac applications, as well as many third-party programs, organize the package contents the same way, so it's worth trying this:[2]
    • Enter sudo "\file path from hard drive to application.app/Contents/MacOS/application name".
      For example, to open iTunes, type sudo "/Applications/iTunes.app/Contents/MacOS/iTunes" and press Return.
    • Enter the password for the administrator account you are currently logged into. Press Return.
    • If the command works, the application should open with root privileges. If the Terminal says "command not found," continue to the next step.
  4. How.com.vn English: Step 4 Open the application's package contents.
    If the quick way didn't work, locate the application in Finder. Right-click (or Control-click) its icon and select Show Package Contents from the drop-down menu.
  5. How.com.vn English: Step 5 Find the executable file.
    You should now see one or more folders inside the application. Locate the executable file inside this folder. This is usually inside /Contents/MacOS.
    • The executable often has the same name as the application, but it could have another name, such as "run.sh."
    • The executable file icon is usually a black square with the word "exec" in small letters.
  6. How.com.vn English: Step 6 Type sudo into Terminal.
    Type sudo followed by a space. Do not enter the command yet.
  7. How.com.vn English: Step 7 Drag the executable file into the Terminal line.
    This should automatically insert the file path to the executable file.
  8. How.com.vn English: Step 8 Confirm the command with your password.
    Hit Return. Enter the password for the administrator account you are logged into, and press Return again. The application should launch with root privileges.
  9. Advertisement
Method 2
Method 2 of 3:

From a Non-Admin Account

Download Article
  1. How.com.vn English: Step 1 Open Terminal in a non-admin account.
    Many system administrators prefer to work in an ordinary user account to limit the possible damage from mistakes or malware attacks.[3] This method still requires an administrator password, but allows you to gain temporary root access without having to switch users. To get started, open a Terminal window.
  2. How.com.vn English: Step 2 Switch to an administrator within the Terminal.
    Enter the command su - followed by a space and an administrator's username on this computer.[4] Enter that administrator's password. You are now operating as that user.
    • The hyphen in the command is optional, but recommended. It sets the environmental variables and directories to those of the admin user, which limits the chance of accidental damage.
  3. How.com.vn English: Step 3 Open the application using sudo.
    The typical usage is sudo "\file path from hard drive to application.app/Contents/MacOS/application name". If this doesn't work or you need more guidance, refer to the administrator instructions above.
  4. How.com.vn English: Step 4 Return to your own account.
    Once you've completed all tasks that require root privileges, enter exit in Terminal. This will exit the administrator user and return you to your normal account.
  5. Advertisement
Method 3
Method 3 of 3:

Troubleshooting

Download Article
  1. How.com.vn English: Step 1 Disable System Integrity Protection (High Risk).
    This feature, introduced in Mac OS 10.11 El Capitan, limits access to important files even for the root user.[5] If you are unable to make the desired changes, you can disable SIP. Only do this if you are confident in your ability and understand that a mistake could wipe your computer or make it nonfunctional:[6]
    • Restart your computer. Hold down Command + R after you hear the start-up noise to enter Recovery Mode.
    • Select Utilities from the top menu, then Terminal.
    • Enter csrutil disable; reboot in Terminal.
    • Let the computer restart as usual. You can now use the steps above to open any application with full root privileges. When you are finished, consider repeating these instructions with enable instead of disable to reinstate SIP.
  2. How.com.vn English: Step 2 Use Nano instead of a graphical text editor.
    It may be safer and more reliable to edit configuration files using a text editor within the Terminal. Nano is a simple option available by default. To use it with root privileges, just enter sudo nano followed by a space and the file path to your text document.[7] You can then edit the document from within Terminal. When finished, press Control + O to save, then Control + X to quit nano.
    • For example, sudo nano /etc/hosts will open the hosts file with root access.
    • It's a good idea to make a backup before you edit any configuration files. To do this, enter sudo cp filepath_of_config_file new_filepath of backup. For example, sudo cp /etc/hosts /etc/hosts.backup creates a copy of the hosts file named hosts.backup. If you make a mistake, move the misconfigured file with (for example) sudo mv /etc/hosts /etc/hosts.bad and restore the backup with sudo cp /etc/hosts.backup /etc/hosts.[8]
  3. Advertisement

Community Q&A

Search
Add New Question
  • Question
    Why does mine say "operation not permitted"?
    How.com.vn English: Community Answer
    Community Answer
    You'll need to be logged in to an administrator account to do that.
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
      Advertisement

      Tips

      • The quotation marks around the file path are only necessary if the file path contains spaces.
      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!
      Advertisement

      Warning

      • A mistake in root access could wipe your computer or make it unusable. The risk is higher in 10.10 or earlier, or in 10.11 with SIP disabled. Keep your administrator password private to prevent others from gaining root access.

      About This Article

      How.com.vn English: How.com.vn Staff
      Co-authored by:
      How.com.vn Staff Writer
      This article was co-authored by How.com.vn Staff. Our trained team of editors and researchers validate articles for accuracy and comprehensiveness. How.com.vn's Content Management Team carefully monitors the work from our editorial staff to ensure that each article is backed by trusted research and meets our high quality standards. This article has been viewed 775,003 times.
      How helpful is this?
      Co-authors: 9
      Updated: September 29, 2023
      Views: 775,003
      Categories: Mac
      Thanks to all authors for creating a page that has been read 775,003 times.

      Is this article up to date?

      ⚠️ Disclaimer:

      Content from Wiki How English language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
      Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

      Notices:
      • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
      • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
      • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
      • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

      Advertisement