I just got a new macbook and installed node.js using the official installer.

For some reason I can only run node.js using sudo node and not just node. I double checked the $PATH and the path to node is in there.

nikke at Nicks-MacBook-Pro in ~
$ node
-bash: node: command not found
nikke at Nicks-MacBook-Pro in ~
$ echo $PATH
nikke at Nicks-MacBook-Pro in ~
$ /usr/local/bin/node -v
-bash: /usr/local/bin/node: Permission denied
nikke at Nicks-MacBook-Pro in ~
$ sudo /usr/local/bin/node -v

My colleague has the same computer and he can run node just fine without having to do sudo. Is this normal? What could I possibly do wrong? The installer didn't say anything about having to do sudo.

I am also having this problem with git, e.g. doing git commit also says Permission denied.

  • 2
    Can you show us node and its directories rights and owner please?
    – ssssteffff
    Jun 28, 2013 at 16:46
  • Let me guess, the colleague installed node, right? What's the output of ls -l /usr/local/bin/node? Jun 28, 2013 at 18:04

2 Answers 2


There are two parts to this phenomenon - i>The location or ii>the nature, of the file may require you to sign in as the administrator as it may act in a way to destabilise the system, or you may simply NOT have the required permissions to execute the file.

As for it working on the colleague's computer, it may be due to a variation of the above mentioned factors.

Try changing the permission of the file(for which you may again need admin rights). If possible, you may also try executing it at a separate location. Sudo does the job perfectly by elevating your position as the Admin of the OS (who has the required rights). This is one of the many security checks native to the OS, to prevent accidental change/damage of the system.

IMP: Your selected location has precious system related files, which the user does not have the right to edit.

Also, did your friend previously log in as the superuser, using



If so, then he already logged in as the superuser and does not need to log in again. The root user privileges is indicated by the # at the end of the prompt instead of $.

  • Thanks for the detailed response! Will check it, indeed your suggestion that he might run su is valid.
    – Nick
    Jun 28, 2013 at 20:23
  • @Nick : You're welcome.. :)
    – Somu
    Jun 29, 2013 at 18:43
  • You're right, it was a permissions issue in the end. My collegue did sudo chmod go+rwx /usr/local/bin and then it started to work! Thanks again :)
    – Nick
    Jul 1, 2013 at 8:38

Probably because the program /usr/local/bin/node is not allowed to be run by "normal" users. You apparently need to be the root user to run it. That is why sudo is needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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