Would it be safe to delete ruby
from my mac (the version that came preinstalled), and replace it with a link to 开发者_C百科ruby1.9
, and do the same with irb
and gem
?
Is there anything specifically that might be an issue?
I wouldn't delete it. Personally, I downloaded ruby's source and compiled/installed it under the /opt directory. Then I edited my path so that /opt/bin/ruby (irb and gem as well) had higher precedence than the system default. This way you can keep the system default and the newest version at the same time. Plus, if Apple ever does update their MacRuby version, you don't have to worry about losing anything or getting down-graded.
I manage this with bash aliases:
alias ruby18=/usr/bin/ruby
alias ruby19=/opt/ruby1.9/bin/ruby
alias ruby=ruby19
It's occassionally handy to have both versions installed, particularly for gems that aren't 1.9-ready.
You could rename the ruby 1.8 binary files to ruby1.8, irb1.8, etc... and then symlink your ruby1.9 files to become 'ruby'. This allows you to use 1.8 if you have a compatibility issue with a project, or you could even use a tool like ruby_switcher to go back and forth between the two very easily. http://github.com/relevance/etc/blob/3d607c8ac2f76077f27c3cbc0140b04a89f546be/bash/ruby_switcher.sh
I wouldn't altogether delete Apple's Ruby. It probably wouldn't hurt anything, but it is part of the system and it's not impossible that some things might expect that version (which includes, for example, RubyCocoa) to be there.
You could, however, install Ruby 1.9 into /usr/local/bin and put that ahead of /usr/bin in your PATH, so that is the default Ruby that gets called when you say ruby
.
As a side note, you might try the well-respected Ruby Version Manager. It's there to help you manage several Rubies side by side.
精彩评论