"bash : command not found" error

I am trying to setup my machine for development and I keep getting the error, -bash: command not found . I am getting while running various commands. I am brand new to this, trying to get into development, and am not sure how to fix it. From what I have read it may have something to do with my PATH. Again, I'm new to this so I really have no clue.

new-host:~ Home$ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin


On OS X, by default, bash should be located as /bin/bash . So if /bin is not in your path then you need to put it there. It sounds like you must have been tweaking the base OS X install considerably. That, or you have installed some packages (macports, fink, brew, etc.???) that have 'adjusted' your path variable, perhaps in undesirable ways.

If you can execute /bin/bash, then you just need to make /bin an entry in your PATH environment variable again. Places to check:

/etc/profile
/etc/bashrc
~/.profile
~/.bashrc

Your only problem is bad typing. You get the error -bash: XXX: command not found when you type something on the command line that isn't a built-in shell function or external executable program in your path. You got -bash: dvm: command not found when you tried to run rvm because you typed dvm instead.

Your $PATH is fine, as /bin is right in there in the middle, so there's no problem with /bin/bash being found.

In order to see what the contents of /etc/profile or ~/.bashrc are, you can't just type their names, like you were doing in the comments to Randy Howard's question, you have to use a command like cat /etc/profile to list its contents.


I didn't have a bash profile. So I created one and voila, no more errors. Thanks again fellas for trying to help a noob!

链接地址: http://www.djcxy.com/p/63350.html

上一篇: 错误:无法取消旧的'README.md'链接(操作不允许)

下一篇: “bash:command not found”错误