How to Enable the Root User on a Mac
Matt Cone January 9, 2021 Tutorials Mac Security
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.
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 on a Mac. Just open the Terminal application and preface a Unix command with sudo
, like this:
sudo rm -rf myfile.txt
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 on a Mac and set the password:
From the Apple menu, select System Preferences.
Select Users & Groups.
Click the lock icon and authenticate with an administrator account.
Select Login Options.
Click Join, as shown in the figure below.
Click the Open Directory Utility button. The Directory Utility window appears.
Click the lock icon and authenticate with an administrator account.
From the Edit menu, select Enable Root User.
Enter the password for the root user in the Password and Verify fields.
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 macOS 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.
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 on a Mac:
- From the Apple menu, select System Preferences.
- Select Users & Groups.
- Click the lock icon and authenticate with an administrator account.
- Select Login Options.
- Click Join, as shown in the figure below.
- Click Open Directory Utility. The Directory Utility window appears.
- Click the lock and authenticate with an administrator account.
- From the Edit menu, select Disable Root User. The root user is now disabled.
Related Articles
Subscribe to our email newsletter
Sign up and get Macinstruct's tutorials delivered to your inbox. No spam, promise!