On macOS, certain parts of the file system are unavailable by default, even if you are the administrator. But if you enable the root user on your Mac, you’ll gain read and write privileges to the entire file system. You can even access files of another user’s account, which is perfect if you forget your username or password or an ex-employee leaves your business without sharing the login details for their company-issued macOS device. Follow this tutorial to learn how to enable the root user on macOS.
How to Enable Root User via the Terminal
You can enable root access via your Mac’s terminal.
- To launch the Terminal, either open a new Finder window and navigate to “Applications -> Utilities -> Terminal” or search for “terminal” using Spotlight.
- In Terminal, type
dsenableroot
after the “%” symbol and press Enter.
- Your username should come up. Enter your user password at the prompt and press Enter.
- Enter or create your root password and verify it.
- You should see a success message indicating that you have enabled the root user.
How to Enable Root User Using the Directory Utility
If you prefer to use a GUI-based option to enable the root user on your Mac, use the Directory Utility instead of the Terminal.
- Open your Mac’s Spotlight by clicking the menu bar icon in the upper-right corner of the screen or pressing Command + Space.
- Search for “directory utility” in the Spotlight window, then select the application when it appears.
- Click on the lock icon in the bottom-left corner of the Directory Utility window.
- Use Touch ID or type your Mac password when prompted.
- Click on “Edit” in the menu bar and select “Enable Root User” from the drop-down.
- A pop-up will appear requesting your root user password. Create or enter your root user password.
- Click “OK” or press Enter to enable the root user.
Note: you won’t get a prompt alerting you that the root user is enabled.
How to Log In as the Root User
Once it’s enabled, you can log in to the root account from the login screen.
- Log out of your current user account.
- Select “Other” on the login screen.
- For “username,” enter your username or “root,” then enter the password you created for your root account.
- Log in to the account.
This account may look the same as a regular user account, but it’s now possible to access, edit, and even delete files that would typically be strictly off-limits, so tread carefully!
To avoid accidental damage to your Mac, you should only log in to the root account when you have a task that specifically requires root privileges.
How to Disable the Root User
To help protect your Mac from malicious activities, or even accidental damage, disable root as soon as it’s no longer required.
How to Disable the Root User Using Terminal
- Launch Terminal via Finder (“Applications -> Utilities”) or Spotlight.
- Enter the
dsenableroot -d
command and press Enter.
- Enter the password for your current account. You should see a prompt letting you know that the root user has been disabled.
How to Disable the Root User Using Directory Utility
- Launch Directory Utility.
- Click on the lock icon in the bottom-left corner of the window and enter your user password or use Touch ID for authentication.
- Click on “Edit” in the menu bar, then select “Disable Root User.”
Note: you don’t need the root account for most fixes. You can even fix a frozen Mac without root access.
How to Change the Root User Password
- Launch “System Preferences.”
- Go to “Users & Groups.”
- Click on the lock icon, then enter the administrator name and password to gain access to the underlying settings.
- Click on “Login Options” in the sidebar.
- Click the “Join” button next to “Network Account Server” in the pane on the right.
- Click “Open Directory Utility” in the pop-up that appears.
- Click on the lock icon in the Directory Utility window, then enter your user password or authenticate with Touch ID.
- From the menu bar in Directory Utility, choose “Edit,” then select “Change Root Password.”
- Enter a new root password when prompted.
Frequently Asked Questions
Can I change the username for the root user account?
No. The root account username is “root” by default on all macOS devices.
Can the password for my Mac and root user be the same?
If you want to set it that way, it’s possible. However, if you have someone else who knows your Mac’s password, they’ll also have access to your computer’s administrative privileges.
Is it safe to keep the root user enabled?
No. By enabling the root user, you’ll have full control over your Mac. While this can be handy for advanced users, it’s also far easier to damage your device or leave your Mac open to attacks. Apple is fully aware of this and has disabled root access by default. For safety, disable the root user after performing administrative tasks on your Mac.
Image credit: markusspiske via Pixabay.
Our latest tutorials delivered straight to your inbox