I'm using fish shell 2.10 on Mac OS X 10.9.1. I would like to use a Ruby that I have installed using RVM as the default in my terminals, however I can't seem to make this work.
I've tried rvm use 2.1.0 --default
but upon opening a new terminal I still get the following:
> which ruby
/usr/bin/ruby
Running the rvm
command causes the ruby to be loaded:
> which ruby
/usr/bin/ruby
> rvm
[...]
> which ruby
/Users/alex/.rvm/rubies/ruby-2.1.0/bin/ruby
But it's annoying to have to do this every time I open a new terminal.
I think to make it easier, you can add a rvm plugin to fish shell via fisher.
For install fisher:
After, install rvm plugin for Fish Shell:
After that, rvm runs perfect
Install oh-my-fish very useful tools, have rvm plugin and many cool another.
This below worked for me from the fish google group forum. credit eggegg for this solution below:
The original support for fish shell requires converting bash script to a fish script. As it mentioned here: https://rvm.io/integration/fish.
I found there's a simpler solution: let bash do the bash scripts, we only need the result of the environment variables.
Code: https://gist.github.com/eggegg/6077153
Just insert the first one into your own config.fish, then copy rvm.fish to ~/.config/fish/functions/ will do the tricks.
This occurs because, out of the box, the Rubies installed through RVM aren't added to your path. When you run any RVM command, it adds the paths relative to the ruby version you're using to $PATH. RVM seems to take care of bash and zsh but doesn't have built-in support for correcting the paths for your dot files.
Here's an example of my path before an RVM command:
Here's an example of my path after running 'rvm':
The bottom line is that you'll want to add the .rvm files to your path depending on the version you default to. This post helped me figure out how to do that. You can append the paths that RVM adds to your fish profile with:
Example from above:
To have this run every time you load fish, add the above command to ~/.config/fish/config.fish. Alternatively, you can add the rvm command to your fish config and have it load it for you.
Hope this helps! -Grant
Firstly install rvm fish functions from rvm.io Just run this in any shell:
You should now be able to use rvm command in fish. (Reopen terminal)
As for now the the above functions don't work for me completely :)
Anyway if you add the below to config file you should be ok:
You should now be able to use ruby related binaries and gems. (Reopen terminal)
In your config.fish load rvm plugin and call it silently:
. ~/oh-my-fish/plugins/rvm/rvm rvm >/dev/null
If you're using bob-the-fish theme you'll have a ruby version in your prompt like this:
ruby-2.1.2 > ~/d/web > master >
Which can be suppressed, if you'd like, by removing the line below in bobthefish/fish_prompt.fish:
__bobthefish_prompt_rubies