我正在尝试使用命令sudo gem install rails
安装rails但是,当我这样做时,我收到以下错误消息:
railties's executable "rails" conflicts with /usr/bin/rails
Overwrite the executable? [yN]
我目前没有安装rails,我不打算安装RVM或rbenv,虽然我可能会在以后这样做。
N.B。目前尚未安装Rails
有人可以告诉我应该做什么吗?
由于
答案 0 :(得分:14)
我刚才在MacBook上安装Rails时遇到过这个问题。我打开了/ usr / bin /目录并在文本编辑器中打开了“rails”文件。这是结果。
#!/usr/bin/ruby
# Stub rails command to load rails from Gems or print an error if not installed.
require 'rubygems'
version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
ARGV.shift
end
begin
gem 'railties', version or raise
rescue Exception
puts 'Rails is not currently installed on this system. To get the latest version, simply type:'
puts
puts ' $ sudo gem install rails'
puts
puts 'You can then rerun your "rails" command.'
exit 0
end
load Gem.bin_path('railties', 'rails', version)
我认为让gem安装程序覆盖这个存根是安全的,但现在更多的是个人偏好。我尽量避免修改任何“核心”文件。
经过快速谷歌搜索后,我发现了这篇很有前途的文章,并将其用于我的安装 Ruby on Rails development setup for Mac OSX
干杯!