1

Hi People I am trying to install a gem file through command prompt on MAC using the following command "gem install filename" but whenever I try to execute the command I get the following error

WARNING: Installing to ~/.gem since /Library/Ruby/Gems/1.8 and /usr/bin aren't both writable. WARNING: You don't have /Users/hemmanshu/.gem/ruby/1.8/bin in your PATH, gem executables will not run. ERROR: Error installing frank-cucumber-0.8.14: cucumber requires gherkin (~> 2.10.0, runtime)

every time I try to execute this command the same thing pops up.

4

3 回答 3

1

您需要以超级用户权限安装 gems,因此您应该使用

sudo gem install [gemname]

代替

gem install [gemname]
于 2012-05-28T06:59:36.973 回答
0

你试试sudo。像“sudo gem 安装文件名”

于 2012-05-28T06:58:34.790 回答
0

...大多数情况下这是一个 PATH 问题,假设您像我一样使用 zshell,然后将此行添加到~/.zshrc文件末尾 export PATH="$PATH:$HOME/.gem/ruby/2.1.0/bin" 如果您使用 bash 作为默认 shell,则将此行添加到~/.bashrc文件末尾 export PATH="$PATH:$HOME/.gem/ruby/2.1.0/bin"

对于您的情况,它将是这样的: export PATH="$PATH:$HOME/.gem/ruby/1.8/bin

最后不要忘记通过source ~/.zshrcz-shell 或source ~/.bashrcbash-shell 重新加载 shell。我认为这对某人有帮助。

于 2015-01-26T07:49:55.860 回答