2

Is it possible to have asdf and rvm coexist? If so, how do you set it up? I made a test project to try out asdf but it seems that's affecting another existing project that's managed by rvm. When I run rails I'm getting:

asdf: No version set for command ruby
you might want to add one of the following in your .tool-versions file:

ruby 2.6.1
Flux
  • 9,805
  • 5
  • 46
  • 92
goterpsgo
  • 307
  • 2
  • 18

2 Answers2

0

I've came across the same issue while installing asdf in macOS. I was able resolve it by creating .tool-versions file and adding the ruby version entry. You can do the same by running following command in the terminal.

$ echo 'ruby 2.6.1' >> .tool-versions

more information can be found here in this blog post

Malik
  • 3,520
  • 7
  • 29
  • 42
0

This is the hack I currently use. Running use-rvm or use-asdf uncomments the respective line in my ~/.bash_profile, and comments the unwanted line.

# RVM
# source $HOME/.rvm/scripts/rvm

# ASDF
. $HOME/.asdf/asdf.sh
. $HOME/.asdf/completions/asdf.bash

# Add Visual Studio Code (code)
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"

use-rvm () {
  sed -i "" 's|^# source $HOME/.rvm/scripts/rvm|source $HOME/.rvm/scripts/rvm|' ~/.bash_profile
  sed -i "" 's|^. $HOME/.asdf/asdf.sh|# . $HOME/.asdf/asdf.sh|' ~/.bash_profile
  bash --login
}

use-asdf () {
  sed -i "" 's|^source $HOME/.rvm/scripts/rvm|# source $HOME/.rvm/scripts/rvm|' ~/.bash_profile
  sed -i "" 's|^# . $HOME/.asdf/asdf.sh|. $HOME/.asdf/asdf.sh|' ~/.bash_profile
  bash --login
}

And here's the gist

Stephen Baidu
  • 31
  • 1
  • 4