-bash: rspec: 命令未找到 [英] -bash: rspec: command not found

查看:90
本文介绍了-bash: 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:

I found rspec in /Library/Ruby/Gems/1.8/gems/rspec-2.6.0/lib I even put a path to it in my .bash_profile: PATH="/usr/local/bin:/Library/Ruby/Gems/1.8/gems/rspec-2.6.0/lib:

但是当我在终端中输入 rspec 时,我找不到命令.即使我与文件 rspec 位于同一目录中?

But when I enter rspec in terminal I get command not found. Even when I'm in the same directory as the file rspec?

除了是个菜鸟,我做错了什么?

Besides being a noob, what am I doing wrong?

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

*Update:*I was able to execute rspec using "bundle exec rspec" but I'd like to figure out why I can't just use rspec.

推荐答案

要使文件作为二进制可执行文件,您通常需要:

for a file to be executable as a binary you generally need to:

(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

这篇关于-bash: rspec: 命令未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆