4

How do I explicitly point my fish shell to RVM's version of rubies?

I'm using fish shell and I installed RVM. However, no matter what I do, RVM doesn't want to switch rubies.

rvm rubies

=* ruby-2.3.0 [ x86_64 ]

> ruby -v                                                             
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]

> rvm use ruby-2.3.0
Using /Users/.../.rvm/gems/ruby-2.3.0

> ruby -v                                                             
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]

my config.fish file contains: rvm default

What am i doing wrong here?

UPDATES:

> which ruby                                                                                                                                         
/usr/bin/ruby

which -a ruby                                                                                                                                      
/usr/bin/ruby

echo $PATH                                                                                                                                         
/usr/local/bin /usr/bin /bin /usr/sbin /sbin

It seems like the path might be wrong, but i'm not sure and not sure how to correct it.

EDIT 2:

Now I changed the path, but it still isn't working:

> echo $PATH                                                          
/Users/.../.rvm/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin
Matthew Berman
  • 8,481
  • 10
  • 49
  • 98
  • Start a fresh shell. If it does not help, provide the information on what shell do you use. It’s config should be updated. – Aleksei Matiushkin May 20 '17 at 06:13
  • Is your `PATH` properly set up to use RVM's Ruby rather than the system Ruby? What does `which ruby` say from the command line? How about `which -a ruby`? – mu is too short May 20 '17 at 06:16
  • Advice: use `ruby-install` and `chruby`. They are much simpler to use. RVM is such bloatware – Marko Avlijaš May 20 '17 at 07:08
  • @muistooshort both say /usr/bin/ruby – Matthew Berman May 20 '17 at 15:37
  • @mudasobwa using fish shell – Matthew Berman May 20 '17 at 15:38
  • 2
    Append this line to your `~/.profile` file to load RVM environment: `PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting`. – Aleksei Matiushkin May 20 '17 at 16:44
  • @mudasobwa I already have this in that file: ` # Add RVM to PATH for scripting. Make sure this is the last PATH variable change. export PATH="$PATH:$HOME/.rvm/bin" [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* ` – Matthew Berman May 20 '17 at 17:52
  • @mudasobwa i tried adding the line you mentioned and it didn't work – Matthew Berman May 20 '17 at 18:00
  • Did you download and install the RVM fish functions as described [here](https://rvm.io/integration/fish)? I guess you might have to relogin into your shell after installation, too. – Matouš Borák May 20 '17 at 20:17
  • Acording to rvm man page fish shell is not supported out of the box. You can find additional notes on the rvm site under "Integration" => "Fish" – slowjack2k May 20 '17 at 20:19
  • @BoraMa yes, I installed the RVM fish functions – Matthew Berman May 20 '17 at 23:55
  • @slowjack2k yes, i followed those instructions – Matthew Berman May 20 '17 at 23:55
  • 1
    I think it would be good to add fish shell to your topic and tags. It's an uncommen setup your using and you need some one with experience with fish shell to look into this. – slowjack2k May 21 '17 at 07:36
  • @slowjack2k I just tried switching back to bash shell and it actually has the same problem...this is something with the shell not pointing to the RVM ruby directory – Matthew Berman May 21 '17 at 16:42
  • Did you also rollback the changes within rvm for fish shell? – slowjack2k May 21 '17 at 17:11
  • @slowjack2k I think so – Matthew Berman May 22 '17 at 18:23
  • Hey @MatthewBerman, have you tried to install the ruby version through RVM (`$ rvm install 2.3.0`) and then use it (`$ rvm use 2.3`)? After that `$ ruby -v` should give you the current version being used by RVM(2.3.0) and `$ which ruby` should now point you to a different path then the one you see above, something like (/home/mpapis/.rvm/rubies/ruby-2.3.0/bin/ruby). Let me know if that helped. Thanks. – kparekh01 May 23 '17 at 18:46
  • Alternatively if the above does not work, you can try to use the following commands. Delete the current default(`rvm alias delete default`) and create a new one(` rvm alias create default 2.3.0`). Referenced from SO earlier answer (https://stackoverflow.com/questions/10632066/cant-change-rvm-default) – kparekh01 May 23 '17 at 18:57
  • @Matthew Berman Did you download and install the fish shell RVM helper code from Github, as instructed on https://rvm.io/integration/fish ? – Jesse Adelman May 27 '17 at 05:44
  • [This StackOverflow answer](https://stackoverflow.com/a/25786967/1607133) fixed this for me. – Juraj Masár Aug 17 '17 at 19:14

1 Answers1

0

Maybe it is a silly observation, but after installing from github:

curl -L --create-dirs -o ~/.config/fish/functions/rvm.fish https://raw.github.com/lunks/fish-nuggets/master/functions/rvm.fish

did you configure the rvm defaul like this?:

echo "rvm default" >> ~/.config/fish/config.fish
developer_hatch
  • 15,898
  • 3
  • 42
  • 75
  • I did, and I am still having a PATH problem for finding the correct `ruby` version, and any of my gem executables. Found those instructions here: https://rvm.io/integration/fish – Pysis Jun 14 '17 at 19:37