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 – perfect if you forget your username or password, or if an ex-employee leaves your business without sharing the login details for their company-issued laptop.
By enabling 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 Mac. Apple is fully aware of this and has disabled root access by default. Follow along with this tutorial to learn how to enable the root user on macOS.
1. Enabling Root via the Terminal
You can enable root access via your Mac’s Terminal. To launch the Terminal, open a new Finder window and navigate to “Applications -> Utilities.”
In the Terminal window, type the following command
and press Enter. The Terminal should detect your username automatically and will then request your password.
Type your password and press Enter.
You’ll be prompted to create a password for the root account. Since the root user essentially has access to every part of your Mac, make sure you choose a strong password!
Once the process is complete, you should see the following message:
Root is now enabled on your laptop or computer, and you can start using it for tasks that would be impossible to complete via a regular user account.
2. Enabling Root using Directory Utility
If you prefer to use a GUI-based option, you can enable the root user on your Mac via the Directory Utility instead:
1. Open your Mac’s Spotlight by clicking the menu icon in the upper-right corner of the screen.
2. In the Spotlight window, search for “Directory Utility,” then select this application when it appears.
3. In Directory Utility, make sure the “Services” tab is selected.
4. In the bottom-left corner, click the little padlock icon and enter your username and password when prompted.
5. In the toolbar, select “Edit -> Enable Root User.”
6. When prompted, create a username and password for your root user.
7. You can now click “OK” to create your root account.
If you want to disable the root user at any point, then relaunch the Directory Utility, but this time select “Edit -> Deactivate root user.”
How to log in to the root user account
Once it’s enabled, you can log in to the root account from macOS’s login screen:
1. Log out of your current account, as normal.
2. On macOS’s login screen, select “Other … ”
3. For “username,” enter “root.” You can now enter your root password.
4. Log in to the account. Congratulations – you’re now a root user!
This account may look exactly the same as a regular user account, but it’s now possible to access, edit and even delete files that would usually be strictly off-limits, so tread carefully!
To be on the safe side, you should only log in to the root account when you have a task that specifically requires root privileges.
Disabling Root User using Terminal
To help protect your Mac from malicious activities, or even accidental damage, you should disable root as soon as it’s no longer required.
To disable root access, launch your Mac’s Terminal (“Applications -> Utilities -> Terminal”), then run the following command:
When prompted, enter the password for your current account. You should see the following message.
The root user account is now disabled on your Mac.
For Linux, you can follow this tutorial to disable the root user account. Do note that you won’t need the root account for most fixes. If you have a frozen Mac, here are some ways to fix it without requiring a root account.