1

I recently updated a nodejs executable using npm and now the executable is pointing to the wrong location. when I run the which command in terminal it is pointing to the old non-existant location. How do I update the executable path or shortcut. I'm not a unix person so not sure where that is set.

I don't necessarily need to update the path for all my apps in the environment, just curious to know why that path for the old executable is still hanging around and pointing to the wrong location.

MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460

2 Answers2

1

bash caches the paths to executables you've run. You can reset the cache with "hash -r" (or start a new bash session or terminal).

Shawn Lewis
  • 214
  • 3
  • 4
0

I don't think which ever returns something that doesn't exist. It shows you which version of the executable is being found, based on the search order in your $PATH environment variable.

This $PATH variable is set in your shell. Type $PATH in the terminal to see what your path variable is set to. (Probably something like /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin)

See this question for some instructions to change your shell path variable: Set environment variables on Mac OS X Lion

Can you give more specific examples of where this stuff is, and what files you are looking at, because I don't think your description makes sense (with regard to "pointing to the old non-existant location")?

Community
  • 1
  • 1
Eve Freeman
  • 32,467
  • 4
  • 86
  • 101
  • which did point to something that didn't exist, but quitting the terminal window and restarting finder seemed to have fixed it. Is that information cached somehow? – MonkeyBonkey Sep 13 '12 at 17:31
  • There are multiple incompatible versions of `which`, so it is precarious to make general statements about its behavior. – tripleee Sep 13 '15 at 08:44