How do I become root on Mac OS X?

You should actually use sudo -i to start an interactive shell. Then, type your login password. It won't appear; that's okay. Keep typing, then press Return.

To exit the interactive shell, type exit or ^D (that's Control-D, not Command-D). You'll then be back in your normal terminal.


Regarding your original question: Use sudo su.

The su command grants you access to another user's account, but you need to know that user's password. Since root is disabled by default (and for good reason), and has no password, you can use sudo, which grants you elevated privileges for one command, to overrule that rule. When sudo prompts you for your password:

[sudo] password for huang:

just enter your password. It won't appear due to security reasons (so people can't see how long it is) but it is being entered. Press Return when done.


OS Sierra

dsenableroot

More info: How to Enable the Root User on Your Mac

Tags:

Macos