-bash:rspec:找不到命令

时间:2011-09-21 17:53:47

标签: bash path rspec

我在/Library/Ruby/Gems/1.8/gems/rspec-2.6.0/lib中找到了rspec 我甚至在.bash_profile中添加了一条路径: PATH =“的/ usr / local / bin中:/Library/Ruby/Gems/1.8/gems/rspec-2.6.0/lib:

但是当我在终端输入rspec时,我找不到命令。即使我和文件rspec在同一个目录中?

除了做菜鸟之外,我做错了什么?

* 更新: *我能够使用“bundle exec rspec”执行rspec,但我想弄清楚为什么我不能只使用rspec。

2 个答案:

答案 0 :(得分:0)

检查您的PATH环境变量是否符合预期。 echo $PATH
检查目标二进制文件是否具有可执行权限ls -l /Library/Ruby/Gems/1.8/gems/rspec-2.6.0/lib
再检查一遍。 which rspec

答案 1 :(得分:0)

要将文件作为二进制文件执行,通常需要:

(a) make the file executable by running chmod 755 /path/to/scripts/awesometask.gem 
(b) add a "shebang" to the top of the file (first line) that contains the path of the interpreter for the script: #!/usr/bin/ruby 
(c) execute file with full path: /path/to/scripts/awesometask.gem 
or
(c1) add the folder where the file is to PATH: PATH=$PATH:/path/to/scripts