Mac – What does the sudo command do

macsudoterminal

I have been a windows user for all of my professional life. I just got a MacBook Pro and want to get started developing with Ruby on Rails.

I have run across several installation guides which recommend using the sudo command. From what I can tell, the sudo command allows you to run a command as an administrator.

What I don't get is… I only have 1 user account on my mac, shouldn't I be the admin user by default?

Why do I need to use the sudo command?

Am I correctly understanding what sudo does?

Best Answer

On the mac, the user you use to log in is by default not the super user (root) account. This is a security feature (Least Privilege) that is by design.

Along with that security model, sudo is a tool that is provided to allow regular (non-root) users to perform root tasks on a case by case basis.

This prevents a whole host of issues, not the least of which is royally screwing up your machine by accident. :)

Related Question