Need to fix PATH in my bashrc file for RVM

I recently installed a clean install of my operating system and copied my old .bashrc file from a backup. I have installed rvm version 1.26.10 (latest stable version). I have installed ruby ​​2.2.0. When I source the .bashrc file, I get the following error:

Warning! PATH is not properly set up, '/Users/myusername/.rvm/gems/ruby-2.2.0@mygemset/bin' is not at first place,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-2.2.0@mygemset'.

      

Here are my PATH instructions. The first line I've included here is the one that was in the fresh RVM installation in the .bash_profile file. I copied them to .bashrc. I am also running postgres.app, which requires the last statement in order to set it as the current PostgreSQL instance.

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
PATH="$PATH:$HOME:/.rvm/rubies/ruby-2.2.0/bin/ruby:/usr/bin/psql:/usr/local:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
export PATH="$PATH:$HOME/.rvm/bin"
export PATH=/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH

      

I started with the .bashrc file recommended by the Ruby on Rails Tutorial by Michael Hartl (version valid 2011 or 2012) and the settings used by RVM. I know that everything has changed since then.

My bash knowledge is limited, so any help would be appreciated.

UPDATE: 2/2/2015 2:40 PM CST

I changed my bash statements to the following and got rid of the warning:

export PATH="$PATH:$HOME/.rvm/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
PATH="$PATH:$HOME:/.rvm/rubies/ruby-2.2.0/bin/ruby:/Applications/Postgres.app/Contents/Versions/9.4/bin:/usr/bin/psql:/usr/local:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"

      

UPDATE: 2/2/2015 5:14 pm CST

Here are my bash instructions:

PATH="$PATH:$HOME:/.rvm/rubies/ruby-2.2.0/bin/ruby:/Applications/Postgres.app/Contents/Versions/9.4/bin:/usr/bin/psql"
export PATH="$PATH:$HOME/.rvm/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

      

Here is the output for echo $ PATH:

/Users/username/.rvm/gems/ruby-2.2.0@gemsetname/bin:/Users/username/.rvm/gems/ruby-2.2.0@global/bin:/Users/username/.rvm/rubies/ruby-2.2.0/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin:/Users/username/.rvm/bin:/Users/username:/.rvm/rubies/ruby-2.2.0/bin/ruby:/Applications/Postgres.app/Contents/Versions/9.4/bin:/usr/bin/psql:/Users/username/.rvm/bin

      

0


source to share


4 answers


rvm expects its stuff to $PATH

be first in $PATH

. You should add items to $PATH

before rvm search, not after.



0


source


My RVM won't stop complaining about PATH, even though the last thing in my .bashrc was this line:

# RVM
source ~/.rvm/scripts/rvm

      

So I just redirected the complaint to /dev/null

:



# RVM
source ~/.rvm/scripts/rvm > /dev/null 2>&1
rvm use default > /dev/null 2>&1

      

The last line also states that RVM is the first in PATH

, so there really isn't much to complain about.

+2


source


After that, over the course of a few days, I decided to go ahead and continue executing my postgres.app with the warning message I received with RVM. I ran my original bash statements in a different order.

export PATH="$PATH:$HOME/.rvm/bin"
PATH="$PATH:$HOME:/.rvm/rubies/ruby-2.2.0/bin/ruby:/usr/bin/psql:/usr/local:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
export PATH=/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH

      

I managed to implement postgres.app. I'm still getting the warning, but my Ruby on Rails apps can find the right gems and run successfully.

0


source


You should add a line like this

export PATH= '/Users/myusername/.rvm/gems/ruby-2.2.0@mygemset/bin:other"

      

Maybe this will help you

0


source







All Articles