I'm not in the position to use RVM because I'm working with a predefined OS and a proxy.
I'm working on CentOS7 and my application uses ruby 2.3.1
. This comes pre-installed on this specific system. CentOS7 supports ruby up to 2.0.0
.
My problem is when I install KDE for a shell it installs ruby 2.0.0 and overrides certain paths so when I use ruby -v
I now use 2.0.0
which is not good!
If I do which -a ruby
I get
/usr/bin/ruby
/opt/rubies/ruby-2.3.1/bin/ruby
If I do echo $PATH
I get
/opt/rh/rh-postgresql95/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/rubies/ruby-2.3.1/bin:/usr/local/rvm/bin
The Ruby I want to use is installed in /opt/rubies/ruby-2.3.1/bin
but /usr/bin
comes before it. Is that the reason why CentOS7 is using that version of Ruby instead of the pre-installed Ruby 2.3.1 version in /opt/rubies/ruby-2.3.1/bin
?
If so, how do I change the order of the path?
The Ruby I want to use is installed in /opt/rubies/ruby-2.3.1/bin but /usr/bin comes before it. Is that the reason why CentOS7 is using that version of Ruby instead of the pre-installed Ruby 2.3.1 version in /opt/rubies/ruby-2.3.1/bin?
Yes, it is the reason.
how do I change the order of the path?
You can redefine the $PATH
in your ~/.bashrc
. Just add this line at the bottom:
export PATH="/opt/rubies/ruby-2.3.1/bin:$PATH"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.