[英]mongo: command not found on Mac OSX even though it's in the PATH
I'm trying to use mongodb on my Mac for a nodeJS app. 我正在尝试在Mac上将mongodb用于nodeJS应用程序。 I followed the steps given here to install mongo.
我按照此处给出的步骤安装了mongo。
First of all, I wanted to know if adding mongodb path to the PATH with "nano .profile", or with "vim .bash_profile" is the same ? 首先,我想知道是否使用“ nano .profile”或“ vim .bash_profile”将mongodb路径添加到PATH是否相同? I'm used to using "nano .profile" and I want to know what are the differences.
我习惯使用“ nano .profile”,我想知道有什么区别。
Then, I added the path to mongodb in the .profile but when I try to use the command "mongo", it tells me "command not found". 然后,我在.profile中添加了mongodb的路径,但是当我尝试使用命令“ mongo”时,它告诉我“找不到命令”。 Although, when I manually type /usr/local/mongodb/bin/mongo (which is the path that I added in .profile), it works.
虽然,当我手动键入/ usr / local / mongodb / bin / mongo(这是我在.profile中添加的路径)时,它可以工作。 I don't understand what's going on and the only solutions I find on the Internet are modifying the .profile, but mine seems correct to me.
我不知道发生了什么,我在互联网上找到的唯一解决方案是修改.profile,但是我的想法对我来说是正确的。
Thanks for you help. 感谢您的帮助。
Mat 垫
I want to know what are the differences.
我想知道有什么区别。
Do a web search for ".bash_profile .profile". 在网络上搜索“ .bash_profile .profile”。 Stackoverflow's guidelines require "thoroughly researched" questions.
Stackoverflow的指南要求“经过深入研究”的问题。 There are countless detailed articles on this topic.
关于此主题的详细文章不计其数。
To get things working try typing exec $SHELL
to reload your shell. 为了使事情正常,请尝试键入
exec $SHELL
以重新加载您的Shell。 If your PATH is correctly set up, typing mongo
should work. 如果您的PATH设置正确,则键入
mongo
应该可以。 Another command to be aware of is rehash
which you need when you add a new program to an existing directory on your PATH because the shell basically scans the entire PATH and makes a lookup table, but when a new command program gets installed after that, the shell doesn't automatically notice. 另一个命令需要注意的是
rehash
,你需要在你添加一个新的方案,以现有的目录上您的路径,因为壳基本上扫描整个路径,使查找表,但是,当一个新的命令程序跑后安装时,外壳不会自动注意到。 That's what rehash
is for. 那就是重新
rehash
目的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.