Got root on MacOS?

Hey you root lovers,

no, it’s not a dream, you can haz root on MacOS, too. First, out of security reasons, I recommend to use sudo to do all the nasty stuff on the console. If that ain’t enough, the root users needs to be enabled first. As on most modern Linux distributions, you can enable the root user by assigning a root password (works on Ubuntu et al.):

1
$ sudo passwd root

The second – more mac oriented – way is the following:

  1. Go to System Preferences and then select Accounts
  2. Click on the lock and authenticate with an administrator account.
  3. Click Login Options….
  4. Click the “Edit…” or “Join…” button at the bottom right.
  5. Click the “Open Directory Utility…” button.
  6. Click on the lock and authenticate with an administrator account.
  7. Choose Enable Root User from the Edit menu.
  8. Enter the root password you wish to use in both the Password and Verify fields, then click OK.

The steps to disable the root user afterwards are nearly the same, so I won’t repeat myself.

The second way was taken from here