0

I want to have different versions of ruby, i am using asdf for it. So, i have installed some different versions of ruby, but i can not switch their, because(maybe) i have /usr/bin/ruby

d@mac ~ % asdf list
ruby
  2.5.1
  2.6.2
sd@mac ~ % asdf global ruby 2.5.1
sd@mac ~ % ruby -v
ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
sd@mac ~ % which ruby
/usr/bin/ruby
sd@mac ~ % whereis ruby
ruby: /usr/bin/ruby /usr/share/man/man1/ruby.1
sd@mac ~ % asdf reshim ruby
sd@mac ~ % ruby -v
ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
sd@mac ~ % asdf exec ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [-darwin21]

I have a problem when trying to delete a read-only file. I have disabled SIP with csrutil, but there's still problem:

sd@mac ~ % ls -la /usr/bin | grep ruby
-r-xr-xr-x     1 root   wheel    167888 Mar 26 09:21 ruby
sd@mac ~ % sudo rm -rf /usr/bin/ruby
Password:
rm: /usr/bin/ruby: Read-only file system
sd@mac ~ % sudo chmod 777 /usr/bin/ruby
chmod: Unable to change file mode on /usr/bin/ruby: Read-only file system

How I can delete /usr/bin/ruby for switching ruby versions?

0

1 Answer 1

0

I have solved problem with env variable ASDF_RUBY_VERSION

ruby -v 
=> ruby 3.2.2

ASDF_RUBY_VERSION=3.2.1 ruby -v 
=> ruby 3.2.1

It is not problem for me, because i have file .envrc for each project, and i am using utility direnv for auto define env vars

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .