Replace ruby ​​with link to ruby1.9, is it safe?

Is it possible to remove ruby from my mac (the version that was previously installed) and replace it with a link to ruby1.9 and do the same with irb and gem ?

Is there anything specific that could be the problem?

+4
source share
4 answers

I would not delete it. Personally, I downloaded the ruby ​​source and compiled / installed it in the / opt directory. Then I edited my path so that / opt / bin / ruby ​​(irb and gem also) has higher priority than the system default. Thus, you can simultaneously save the system version and the latest version. In addition, if Apple ever updates its version of MacRuby, you don’t need to worry about losing anything or downgrading.

+3
source

I control this with bash aliases:

 alias ruby18=/usr/bin/ruby alias ruby19=/opt/ruby1.9/bin/ruby alias ruby=ruby19 

It is sometimes useful to install both versions, especially for gems that are not ready for 1.9.

+1
source

You can rename ruby ​​1.8 binaries to ruby1.8, irb1.8, etc., and then symbolize your ruby1.9 files to become a ruby. This allows you to use 1.8 if you have a project compatibility problem, or you can even use a tool like ruby_switcher to switch between them easily and quickly. http://github.com/relevance/etc/blob/3d607c8ac2f76077f27c3cbc0140b04a89f546be/bash/ruby_switcher.sh

0
source

I would not delete Apple Ruby at all. It probably won't hurt anything, but it’s part of the system, and it’s possible that some things can be expected to have a version (which includes, for example, RubyCocoa).

However, you can install Ruby 1.9 in / usr / local / bin and put it before / usr / bin in your PATH, so this is the default Ruby, which is called when you say ruby .

As a side note, you can try the reputable Ruby Version Manager . This will help you manage multiple rubies side by side.

0
source

Source: https://habr.com/ru/post/1299705/


All Articles