Reputation: 52570
Fresh install of macOS Sierra on a new MBP, /usr/local/bin
requires root to access the files. But many programs, including node
and npm
install their executables to /usr/local/bin
. I can't execute them unless I'm root. Am I supposed to change permissions on /usr/local/bin
in macOS Sierra? Seems there's a reason for the stricter permissions.. Are tools like node/npm just not up to date with how things are done in the latest mac OS and I should move those files to somewhere else like /usr/bin
?
Upvotes: 1
Views: 2331
Reputation: 546
Change npm's default directory to another directory that requires you not to run it as root
mkdir ~/my/path
npm config set prefix '~/my/path'
Open or create a ~/.profile file and add this line:
export PATH=~/my/path/bin:$PATH
Back on the command line, update your system variables:
source ~/.profile
Test: Download a package globally without using sudo.
Upvotes: 1