Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Railties's executable "rails" conflicts with /usr/bin/rails

I'm trying to install rails using the command sudo gem install rails however, when i do so i get the following error message:

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

I do not currently have rails installed and i'm not looking to install RVM or rbenv, although i will likely do so at a later date.

N.B. Rails is not currently installed

Can someone advise what i should do?

Thanks

like image 259
Robbo Avatar asked Jul 06 '14 11:07

Robbo


Video Answer


1 Answers

I came across this issue just now when installing Rails on my MacBook. I opened the /usr/bin/ directory and opened the "rails" file in a text editor. Here's the result.

#!/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)

I figure it's safe to let the gem installer override this stub, but now it's more of a personal preference. I try to avoid modifying any "core" files whenever possible.

After a quick Google search, I came across this promising article and will be using it for my install.
Ruby on Rails development setup for Mac OSX

Cheers!

like image 50
Mat Hellums Avatar answered Sep 29 '22 13:09

Mat Hellums