How to enable root user on Mac Terminal


The root user is disabled on the Mac by default due to security reasons, one may not need the root user access, as an admin has most of the privileges that would suffice any task you want to perform using the Terminal.

"It's safer to use the sudo command in Terminal instead of enabling the root user. To learn about sudo, open the Terminal app and enter man sudo."

Reference: https://support.apple.com/en-in/HT204012

Steps:

  1. Open Terminal App.
  2. Run the Command:
    sudo passwd root
    
  3. You will be prompted to set a password.
  4. Once set, you can access root user using su - command.
    Code2care@Mac % sudo su -
    Password:
    C2C-Tech-Mac:~ root# 

Note: As it is not advisable to make use of the root user for day-to-day tasks, its better to disable the root user after use with the below command.

sudo passwd -l root
Switch to Root user Mac
-




Have Questions? Post them here!