Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make fish shell use an rvm ruby by default

Tags:

macos

ruby

rvm

fish

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.

like image 824
Alex Avatar asked Jan 24 '14 13:01

Alex


People also ask

How do I make Ruby default and current?

Set Ruby version with rvm on Mac 0 on the command line. To switch to the system ruby, enter rvm use system . To switch back to the default, rvm default . The command rvm list will show all installed Rubies, including the current and default versions.

What is RVM in Ruby on Rails?

RVM, or Ruby Version Manager, is a command line tool that lets you manage and work with multiple Ruby development environments and allows you to switch between them. In this tutorial, you will install RVM, the stable release of Ruby on Rails (or the specific version of your choosing) via RVM, and Node.


1 Answers

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.

like image 118
wieczorek1990 Avatar answered Oct 02 '22 16:10

wieczorek1990