I have installed node.js at custom location and added the location to the $PATH in .profile file.Hoons-MacBook-Air:npm Eonil$ node --versionv0.6.2Hoons-MacBook-Air:npm Eonil$ which nodeHoons-MacBook-Air:npm Eonil$ echo $PATH/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:~/Unix/homebrew/binHoons-MacBook-Air:npm Eonil$ cat ~/.profileexport  PATH=$PATH:~/Unix/homebrew/binHoons-MacBook-Air:npm Eonil$ Node.js itself runs well. The problem is it is not listed by which command. So I can't install npm now. Because npm install cannot find the location of node.js. How can I make the node binary discovered by which?
How to add home directory path to be discovered by Unix which command?
path;profile;home;which
This is happening because ~ has not been expanded. Your shell knows how to deal with this, but which does not (nor would most other programs). Instead, do:export PATH+=:$HOME/Unix/homebrew/binAlternatively, stop using which, and use the (almost always superior) type -p.Here is a demonstration of the issue:$ echo $PATH/usr/local/bin:/usr/bin:/bin$ export PATH+=:~/git/yturl$ yturlUsage: yturl id [itag ...]$ which yturl$ type -p yturl/home/chris/git/yturl/yturl$ export PATH=/usr/local/bin:/usr/bin:/bin:$HOME/git/yturl$ which yturl/home/chris/git/yturl/yturlBear in mind that some other programs that look at $PATH may not understand the meaning of ~ either, and take it as part of a relative path. It's more portable to use $HOME.