The root user is disabled by default. Follow the steps in this article to enable or disable the root account.
Only an account with administrative privileges can enable the root account.
Enabling the root user

Mac OS X 10.5 or later
1. From the Finder’s Go menu, choose Utilities.
2. Open Directory Utility.
3. Click the lock in the Directory Utility window.
4. Enter an administrator account name and password, then click OK.
5. Choose Enable Root User from the Edit menu.
6. Enter the root password you wish to use in both the Password and Verify fields, then click OK.
Note: If you are troubleshooting an issue that prevents you from logging in as an administrator, follow the steps in this article to enable the root user.

Mac OS X 10.4.x or earlier
1. Click the Finder icon in the Dock.
2. From the Go menu, choose Applications.
3. Open the Utilities folder.
4. Open the NetInfo Manager utility.
5. Click the lock in the NetInfo Manager window.
6. Enter an administrator account name and password, then click OK.
7. For Mac OS X 10.2 and later, choose Enable Root User from the Security menu.
8. For Mac OS X 10.0 and 10.1, choose Security from the Domain menu, then Enable Root User from the submenu.
9. If you have not previously set a root password, an alert box may appear that says “NetInfo Error,” indicating that the password is blank. Click OK.
10. Enter the root password you wish to use and click Set.
11. Enter the password again for verification and click Verify.
12. Click the lock again to prevent changes.

How to log in as root

Use these steps for Mac OS X 10.2 or later:
1. If you are logged in, choose Log Out from the Apple menu.
2. If you are logging in from a list of usernames with pictures, click Other.
3. In the Name field, type: root
4. In the Password field, type the password you defined in the steps above.

Mac OS X 10.0 to 10.1.5
After enabling the root user, log out and log back in as the root user. Logging in by typing your username in a text entry field is the default behavior in earlier versions of Mac OS X. You can choose either method in Login preferences. The root user does not appear in the list, so you need the text entry option. If necessary, follow these steps to change the login method to text entry:
1. From the Apple menu, choose System Preferences.
2. From the View menu, choose Login.
3. Click the Login Window tab.
4. Select the radio button for “Name and password entry fields.”
Follow these steps to log in as root:
1. If you are logged in, choose Log Out from the Apple menu.
2. In the Name field, type: root
3. In the Password field, type the password you defined in the steps above.

Disabling the root user

Mac OS X 10.5 or later
1. Open Finder.
2. From the Go menu, choose Utilities.
3. Open the Directory Utility.
4. Click the lock in the Directory Utility window.
5. Enter an administrator account name and password, then click OK.
6. Choose Disable Root User from the Edit menu.

Mac OS X 10.4.x or earlier
1. Open NetInfo Manager. It’s in the Utilities folder.
2. Click the lock.
3. Enter the name and password for an administrator account, then click OK.
4. For Mac OS X 10.2 and later, choose Disable Root User from the Security menu.
5. For Mac OS X 10.0 and 10.1, choose Security from the Domain menu, then Disable Root User from the submenu.