I'm trying to install Mongo but having trouble with the $PATH var in MacOS. Following the guidelines. My $PATH is set in .bash_profile:
export PATH=/Users/evl/dev/mongodb/bin:$PATH
which works:
echo $PATH
/Users/evl/dev/mongodb/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
entering mongo on command line from other directory:
:~ evl$ mongo
-bash: mongo: command not found
I expected that mongo would be found now the $PATH is set
entering ./mongo on command line from mongo bin directory:
cd /Users/evl/dev/mongodb/bin
./mongo
MongoDB shell version v4.0.3
connecting to: mongodb://127.0.0.1:27017
So now mongo runs. But only if I move to the folder and I enter './mongo'.
I would expect with the $PATH variable set correctly, the executable would run from any directory. It should actually. What is going wrong? Any help is appreciated!
Best Answer
I just typed everything again, exactly the same as before, but no copy-paste, and now the issue was gone. Some strange characters, invisible, might have shifted in .. Weird.. but happy to continue now..