1

I did a clean install of my operating system recently and copied my old .bashrc file from a backup. I installed rvm version 1.26.10 (latest stable version). I 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 statements. The first line I included here is one that was in the new install of RVM in the .bash_profile file. I copied them into .bashrc. I'm 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 (the version current in 2011 or 2012) and the settings used by RVM back then. I know things have changed a bit 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 statements:

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

4 Answers4

3

My RVM wouldn'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 complaining to /dev/null:

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

The last line also makes sure RVM is first in PATH, so it doesn't really have anything to complain about.

Hubro
  • 56,214
  • 69
  • 228
  • 381
0

rvm expects its $PATH stuff to come first in $PATH. You should add items to the $PATH before sourcing rvm, not after.

mipadi
  • 398,885
  • 90
  • 523
  • 479
  • I moved my statements around and got rid of the message. I have updated my question with my solution. Unfortunately it breaks the logic for postgres.app. The bash statements automatically add the server app folder for the Apple version of PostgreSQL before my postgres.app entry. I will have to find out how to override this without breaking RVM. – Pamela Cook - LightBe Corp Feb 02 '15 at 20:41
  • @LightBeCorp: It's because you're not exporting the `$PATH` after the final modifications. Why not just move the sourcing of the rvm script to _after_ your `$PATH` modifications? – mipadi Feb 02 '15 at 20:52
  • I just did. The warning is gone like before. However it does not solve my problem with postgres.app needing to have its folder upfront. I am asking a question in Ask Different to see if there is a solution. Thanks so much for your help. – Pamela Cook - LightBe Corp Feb 02 '15 at 21:14
  • Not sure if RVM is doing this or the server app. Here is another question where a person is having a similar problem unfortunately with no solution: http://stackoverflow.com/questions/24960795/rvm-keeps-adding-a-directory-to-my-path-and-then-throws-a-warning-that-path-isn – Pamela Cook - LightBe Corp Feb 02 '15 at 21:22
  • @LightBeCorp: Did you put everything before the line where you sourced the rvm script? In your update, it looks like you're still putting a line after that. – mipadi Feb 02 '15 at 21:49
  • I just updated my question with the bash statements. I'm not sure if it is right or not. The PATH still has additional folders added that I do not have in my bash statements. The warning is gone. Unfortunately I still have the problem with postgres.app. I have not heard anything yet from Ask Different about if there is a way to override the server app folders. I guess for now I will have to either manually set the gemset, the postgres.app psql path or remove RVM altogether at this point. – Pamela Cook - LightBe Corp Feb 02 '15 at 23:21
  • I have not heard anything from the Postgres.app team nor the Ask Different team about why my bash statements are adding server app folders that are not in my .bashrc file. At this point I plan to consider using Homebrew to install another instance of PostgreSQL and drop postgres.app even though using it is a lot easier for implementing PostgreSQL. I have used RVM and Phusion Passenger for several years and would hate to remove RVM at this point. – Pamela Cook - LightBe Corp Feb 04 '15 at 16:58
0

After dealing with this for several days I decided to go ahead and continue to proceed with my implementation of postgres.app with the warning message I got 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 was successful in implementing postgres.app. I still get the warning message but my Ruby on Rails applications are able to find the correct gems and run successfully.

0

You should add the line like this

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

Maybe that can help you

张华轩
  • 11
  • 2