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

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright ยฉ Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap