2

when trying to install Ruby, Vagrant, and Grunt using terminal I am still required to use sudo on my installs. I am sole proprietor of the laptop and have an administrator account. Shouldn't I be able to install software without using sudo?

  • Please don't alter your question to include followup questions. Either use comments below the answers to ask for clarification or ask a new question (with a link to this one here for reference). – nohillside Mar 5 '15 at 6:07
7

Even though the account is an administrator, you still need to use sudo to become the root user. Administrator still has restrictions on what files can be read or written to.

For example, the /System/Library/User Template/ folder is set to System: Read/Write and even though you are an administrator, you won't be able to open this folder without either changing the permissions or using sudo to become the root user.

  • 1
    I think you need to add that Non admin accounts can't run sudo - only users in the admin group - see /etc/sudoers file – Mark Mar 4 '15 at 19:25
  • @Mark hmm all users/members of special groups listed & enabled in the sudoers file can run sudo, even non-admin. – klanomath Mar 4 '15 at 19:39
  • 1
    @klanomath which by default is user root and group admin only - The default file has commented out lines showing examples – Mark Mar 4 '15 at 19:42
  • @grgarside Yes, but I am not sure how on my work machine I can run and install Vagrant and Ruby gems without using sudo but on my personal machine I have to use sudo. Is there something my IT department would of done to make my directories that house my Ruby Gems and Xcode writable? – Irish Stand Down Mar 5 '15 at 2:02
  • Sometimes installers will ask if you want to install for all users of the computer or just the current user. When that is supported, the current user does not need to enter a password because all files are installed beneath the home directory. It's possible that when you installed Vagrant as a non-admin user (at work), it skipped straight to that option. Can you check where the apps and/or libraries were actually installed on your work machine? – Kent Mar 5 '15 at 6:20
2

This is by design. The vast majority of users want to install GUI software and adjust system settings, but do not want to install command-line software. Those same users would prefer malware have a harder time getting into the process, and often need to be protected from themselves ("Library"? Don't need a folder of books...). So the admin user is not root.

Those users who are familiar with the Unix layer know about sudo, and should also know how to add specific commands to sudoers when needed. There's also the sudo bash method of getting a root shell.

-1

No, you need to use sudo because you are not root user (good thing, because you don't want to accidentally wreck the computer), sudo allows you to momentarily "become" root. If you were not an administrator, you are not one of the privileged users that are allowed to use sudo, and thus, you would not be able to install anything requiring sudo.

  • How does this improve on other answers? – Mark Oct 5 '15 at 16:08
  • @Mark, I thought it covered the reason you use sudo as an admin user and the inability to use it as a normal user a little more then the other answers. – Caleb Kleveter Oct 5 '15 at 16:17
  • Granting sudo to non-admin users just requires a quick edit of the sudoers file, so I don't think this constraint really is worth mentioning – nohillside Oct 5 '15 at 16:41
  • @patrix, how do you do that? – Caleb Kleveter Oct 5 '15 at 20:43
  • 1
    If apple.stackexchange.com/questions/206688/… doesn't give enough insight to get you started, please use the "Ask Question" link on top :-) – nohillside Oct 6 '15 at 7:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .