Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers

up vote 5 down vote accepted

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. :)

share|improve this answer
    
Thanks a lot for your help. –  jessegavin Sep 7 '10 at 1:39
add comment

Part of the confusion you're running into is the terminology. In OS X, there are 3 main levels of account privilege you'll run into:

root (aka the superuser, System Administrator, or System): this is a specific account (not just a type of account), and is generally all-powerful. For example, root has full access to all files on the system, not matter what their permissions are. It is generally a bad idea to log in as root, so by default the account is disabled (and mostly hidden). This roughly corresponds to what you're probably calling "Administrator".

Administrator: this is the type of account you have; it's allowed to make system-wide changes, but usually has to do something special (i.e. click a padlock icon and authenticate) to enable that access. For instance, if you try to copy a file you don't have read access to, the Finder will require you to authenticate before copying the file. The sudo command is another example of this -- it allows administrators to promote themselves temporarily to root.

Standard user: no special privileges, not allowed to mess with (most) system-wide settings or bypass access restrictions.

There's also sort-of a fourth category: managed accounts are standard accounts that have "parental controls" applied to them.

share|improve this answer
add comment

I don't have a Mac, but i am a Unix user. No you are not the only user, your are running as a normal user, for security reasons. Imagine you downloaded a virused program and run it as administrator, all your system may be damaged. But if you run it as normal user, only your home directory may be infected, not the whole system.

It also prevent you from doing some dangerous tasks by fault(eg. rm -rf /*, this will remove all the files on your HDD, even the system)

You can use super user for your daily use, but this is highly discouraged.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.