The place to learn about your Mac. Tips and tutorials for novices and experts.

How to Enable the Root User in Mac OS X


The most advanced tasks demand the most powerful user account of them all: the root user. When you log in as root, you have read and write privileges to every file on your Mac. This awesome power lets you override any account or permission restriction, but be careful! You could really mess things up if you don’t know what you’re doing.

Warning: The root account is disabled by default. To prevent accidents, you should only enable and utilize the root account when you absolutely need it.

Acting as Root with Sudo

Before you enable the root user account on your Mac, you should know about an alternative called sudo. As in other Unix-based operating systems, this command allows administrators to temporarily act as the root user in Mac OS X . Just open the Terminal application and preface a Unix command with sudo, as shown below.


Most commands can be executed with sudo, but you’ll need to authenticate with your administrator password to execute the command as root. System administrators consider using sudo a best practice - you should always try using sudo before you log in as root!

Enabling the Root User Account

Ready to turn on your Mac's superuser account? Here’s how to enable the root user account in Mac OS X and set the password:

  1. From the Apple menu, select System Preferences.

  2. Select Users & Groups.

  3. Click the lock and authenticate with an administrator account.

  4. Select Login Options.

  5. Click Join, as shown in the figure below.

  6. Click Open Directory Utility. The Directory Utility window appears.

  7. Click the lock and authenticate with an administrator account.

  8. From the Edit menu, select Enable Root User.

  9. Enter the password for the root user in the Password and Verify fields.

  10. Click OK to enable the root user and save the password.

Logging in as Root

Now you can log in as the root user at the Mac OS X login screen. When the list of users appears, click Other, type root in the Name field, and enter your root password in the password field. You'll be logged in as root until you log out, restart, or shut down your computer.

Note: To log in as root from the OS X login screen, you must have automatic login and FileVault disabled. Follow the instructions in our How to Password Protect Your Mac tutorial.

If you're an expert at the command line and would rather not log in to your computer as the root user, you can enter the su command in the Terminal application. Enter the root user account password and you'll be acting as the root user for the duration of your Terminal session, or until you type exit.

Remember, you should only log in as the root user when absolutely necessary.

Disabling the Root User Account

Once you've used the root user account to flex your superuser muscles, you should consider disabling it for security purposes. Here's how to disable the root user account in Mac OS X:

  1. From the Apple menu, select System Preferences.

  2. Select Users & Groups.

  3. Click the lock and authenticate with an administrator account.

  4. Select Login Options.

  5. Click Join, as shown in the figure below.

  6. Click Open Directory Utility. The Directory Utility window appears.

  7. Click the lock and authenticate with an administrator account.

  8. From the Edit menu, select Disable Root User. The root user is now disabled.


Final Thoughts

These instructions are written for Mac OS 10.7 and 10.6. If your Mac is running an earlier version of Mac OS X, follow the instructions provided on Apple's Support website to enable the root user on your computer. And as of November 2011, some users running OS 10.7 may not be able to log in as root from the login screen. See this forum thread on Apple's website for more information.

For background information on the root user account - what it can do, and how you can use it - see this article.

Meet Your Macinstructor

Matthew Cone, the author of Master Your Mac, has been a Mac user for over 20 years. A former ghost writer for some of Apple's most notable instructors, Cone founded Macinstruct in 1999, a site with OS X tutorials that boasts hundreds of thousands of unique visitors per month. You can email him at: matt@macinstruct.com.


 
                          





Copyright © 1999-2014 Macinstruct LLC. This work is licensed under a Creative Commons License.