How to make fish shell use an rvm ruby by default
Firstly install rvm fish functions from rvm.io
curl -L --create-dirs -o ~/.config/fish/functions/rvm.fish https://raw.github.com/lunks/fish-nuggets/master/functions/rvm.fish
You should now be able to use rvm command in fish after reopening terminal.Run the following to add the line rvm default
to your fish config file.
echo 'rvm default' >> ~/.config/fish/config.fish
You should now be able to use ruby related binaries and gems after reopening terminal. RVM is not setting my PATH in `fish`, but should be
Some kind of solution
So far I have it barely working by making the change from:
grep -E '^rvm|^GEM_PATH|^GEM_HOME'
to:
grep -E '^rvm|^[^=]*PATH|^GEM_HOME'
Not sure what side effects that will cause, but from looking at the rvm.fish
code, that would seem to be missing.
Related aside
An older version had the ^[^=]*PATH\
term in it, like my system's previous version, and can also be randomly found here: GitHub Gist - ToniRib/rvm.fish
That is for escaping the pipe (|) characters, but I can't see why that is needed inside of single quotes. My fix works specifically without the backslashes, and just plain pipe characters.
Non-functional alternative
I have alternatively tried a patch without the other code such as this one:
and set -xg GEM_PATH (echo $GEM_PATH | sed 's/ /:/g')
and set -xg PATH (echo $GEM_PATH | sed 's/:/ /g') $MY_RUBY_HOME/bin $PATH
I am continuing to add lines to it, but still see various errors. First I needed the "rubies" directory for the correct version of ruby
, then both gem paths modified with spaces for fish
, and still I am having issues, so taking bash
's PATH
environment variable wholesale and letting the rvm
script do its own work is the best I have so far. system(rvm 2.5.3 do ruby -v) leads to Warning! PATH is not properly set up
Solution was to add set -gx PATH $HOME/.rvm/bin $PATH
to my ~/.config/fish/config.fish
.
Hope it helps others.
RVM is not a function, selecting rubies with 'rvm use ...' will not work
Your console is not running as a login shell and hence have no access to rvm function. If you are running Ubuntu, you can:
- Open console
- Select Edit -> Profile Preferences
- Select tab: Title and Command
- Check box 'Run command as a login shell'
- Restart terminal
How can I use rvm within a Makefile?
When you call RVM from cron (or a Makefile, I would expect) it's important to set up the right environment. The Scout team have a great blog article explaining this:
http://blog.scoutapp.com/articles/2010/09/07/rvm-and-cron-in-production
The important part is ensuring you have a full login shell so you have access to RVM.
/bin/bash -l -c 'the_command_inside_makefile"
To use bash --login by default with capistrano 3 + sshkit + rvm
you can not use rvm use
from scripts - unless you source rvm first like you did with the prefix
,
but you can use rvm ... do ...
in scripts without sourcing:
execute :rvm, "#{ Configs.rvm.ruby }@#{ Configs.rvm.gemset }", "--create", :do, :true
Related Topics
Rvm - Macports Won't Update Through Proxy
Rvm Can No Longer Install 1.8.7-P352 on MAC Os X Mountain Lion
Foreign Key (Class_Id) Not Populating in Belongs_To Association
Capistrano, Firewalls and Tunnel
How to Make Two Thor Tasks Share Options
Resizing an Image with Mini_Magick
Use Pry in Gems Without Modifying The Gemfile or Using 'Require'
Rake Aborted: Could Not Find Rspec
How to Create Thor::Group Generators as Args of My_Command
Are Rack-Based Web Servers Represent Fastcgi Protocol
Cucumber Embed for Screenshots Not Linking to Screenshot
Ruby: Parse Excel 95-2003 Files
How to Use (Ruby) Rgeo to Transform (Unproject) Coordinates
Sqlite3::Sqlexception: Duplicate Column Name While Migrating
How to Handle Single Table Inheritance in Simpleform So a Single Helper Handles All Models