2014-07-06 20 views
9

我試圖安裝導軌使用命令sudo gem install rails然而,當我這樣做,我得到以下錯誤信息:Railties的可執行文件「軌」的衝突與在/ usr/bin中/導軌

railties's executable "rails" conflicts with /usr/bin/rails 
Overwrite the executable? [yN] 

我不目前已經安裝了導軌,我不想安裝RVM或rbenv,儘管我可能會在稍後的日期安裝。

N.B. Rails目前沒有安裝

有人可以提醒我該怎麼辦?

感謝

+0

在您的終端中,鍵入'rails -v'時會發生什麼? – Anthony

+0

它表示導軌目前尚未安裝。 – Robbo

+0

你是否遵循過[如此](http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/)等指南?請詳細說明如何安裝到目前爲止。 – Jonathan

回答

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) 

我認爲可以安全地讓寶石安裝程序覆蓋這個存根,但現在它更多的是個人偏好。我儘量避免修改任何「核心」文件。

經過Google的快速搜索,我遇到了這篇很有前途的文章,並將其用於我的安裝。
Ruby on Rails development setup for Mac OSX

乾杯!