When getting up and running with a new machine I often run into this issue and completely forget why on earth it's happening. This StackOverflow post gives the overview of the issue and solution.
Essentially on a default installation this folder is owned by root and missing the appropriate permissions for your user. So the commands in usr/local/bin
only work when used with sudo
. To resolve this we can take ownership of /usr/local
by running the following:
$ sudo chown -R $(whoami) /usr/local
$ sudo chown -R $(whoami) ~/.local
That second command is helpful for npm packages making use of the .local
folder.