I am a admin on my Mac with OSX and I have enabled root user. When I try to use the terminal without typing sudo it does not seem to recognise my privileges as an admin, but it works fine if I type sudo and enter my password.
I also have tried to manually give the sudo privileges in the /etc/sudoers file, but still no luck.
Running an installation through NPM all I get is: "npm ERR! Please try running this command again as root/Administrator."
Why is this and how can I fix it?
Best Answer
This is standard behaviour in OS X, even if you are an Administrator, you will not be able to write to anything under
/
, apart from your home directory without prefixing your command withsudo
. Even if you do usesudo
orsudo su -
(to gain access to a root shell), you will not be able to make changes to anything under/usr
(except/usr/local
),/bin
./sbin
,/etc
, etc... without disabling rootless mode/SIP (System Integrity Protection) from recovery mode. You can disable it using the commandcsrutil disable
. Note that rootless mode is new in OS X 10.11 El Capitan. If you still can't getnpm
working withsudo
, try usingsudo whoami
and check that it outputsroot
, and usesudo -u root
.