0

I've recently run into the following error from rvm when trying to upgrade my ruby version.

Warning! PATH is not properly set up, '/home/sam/.rvm/gems/ruby-2.2.1/bin' is not at first place,

My echo $PATH is as follows:

/usr/local/heroku/bin:/home/sam/.rvm/gems/ruby-2.2.1/bin:/home/sam/.rvm/gems/ruby-2.2.1@global/bin:/home/sam/.rvm/rubies/ruby-2.2.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/sam/.rvm/bin:/home/sam/.rvm/bin:/home/sam/.rvm/bin:/home/sam/.rvm/bin

My .bashrc has the following lines in it

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

And .bash_profile has:

[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile


[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

And my rvm info is as follows

Warning! PATH is not properly set up, '/home/sam/.rvm/gems/ruby-2.2.1/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.1'.

ruby-2.2.1:

  system:
    uname:       "Linux bitey0asus 3.13.0-77-generic #121-Ubuntu SMP Wed Jan 20 10:50:42 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux"
    system:      "ubuntu/14.04/x86_64"
    bash:        "/bin/bash => GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
    updated:      "10 minutes 55 seconds ago"
    path:         "/home/sam/.rvm"

  ruby:
    interpreter:  "ruby"
    version:      "2.2.1p85"
    date:         "2015-02-26"
    platform:     "x86_64-linux"
    patchlevel:   "2015-02-26 revision 49769"
    full_version: "ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]"

  homes:
    gem:          "/home/sam/.rvm/gems/ruby-2.2.1"
    ruby:         "/home/sam/.rvm/rubies/ruby-2.2.1"

  binaries:
    ruby:         "/home/sam/.rvm/rubies/ruby-2.2.1/bin/ruby"
    irb:          "/home/sam/.rvm/rubies/ruby-2.2.1/bin/irb"
    gem:          "/home/sam/.rvm/rubies/ruby-2.2.1/bin/gem"
    rake:         "/home/sam/.rvm/rubies/ruby-2.2.1/bin/rake"

  environment:
    PATH:         "/usr/local/heroku/bin:/home/sam/.rvm/gems/ruby-2.2.1/bin:/home/sam/.rvm/gems/ruby-2.2.1@global/bin:/home/sam/.rvm/rubies/ruby-2.2.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/sam/.rvm/bin:/home/sam/.rvm/bin:/home/sam/.rvm/bin:/home/sam/.rvm/bin"
    GEM_HOME:     "/home/sam/.rvm/gems/ruby-2.2.1"
    GEM_PATH:     "/home/sam/.rvm/gems/ruby-2.2.1:/home/sam/.rvm/gems/ruby-2.2.1@global"
    MY_RUBY_HOME: "/home/sam/.rvm/rubies/ruby-2.2.1"
    IRBRC:        "/home/sam/.rvm/rubies/ruby-2.2.1/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

I found a solution to a similar problem here. But apparently not close enough (the proposed solution had no effect).

Anyway if anyone has any ideas, I'd appreciate it. I'm a little clueless on the ins and outs of rvm so I'm a bit in the dark here. Thanks in advance

Edit:

I tried reversing the order of the two rvm lines in my .bashrc but this did not help the error, nor did it change the order shown by echo $PATH.

Community
  • 1
  • 1
neanderslob
  • 2,633
  • 6
  • 40
  • 82

2 Answers2

1

Your PATH does not start with /home/sam/.rvm/gems/ruby-2.2.1/bin because you have a line prepending the Heroku toolbelt path.

You can check this is true by running this in your terminal:

PATH=/home/sam/.rvm/gems/ruby-2.2.1/bin:$PATH rvm info

It shouldn't complain. The problem comes from Heroku toolbelt modifiying your env in ways rvm doesn't care for. As per this post, the fix is to change your .bashrc like so:

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
# Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

You can remove the rvm line from .bash_profile

Community
  • 1
  • 1
David K-J
  • 930
  • 7
  • 14
  • Sorry, I should have included this in my question: I had thought the same thing but when I tried this, nothing changed. `echo $PATH` still showed heroku as being first. I even gave the machine a restart but to no avail. I also checked out my `.bashrc` on my other machine (which is free of this error) and it is in the same order as shown in my question. – neanderslob Feb 18 '16 at 11:58
  • Hmm. I initially thought that `PATH` might have been set the wrong way around, but actually digging into the code I was incorrect. I'll think some more – David K-J Feb 18 '16 at 12:17
  • Figured it out. (At least I fixed it; I know how, but not why). I commented out the heroku line in my bashrc and found that it changed my path order to `/home/sam/.rvm/gems/ruby-2.2.1/bin:/home/sam/.rvm/gems/ruby-2.2.1@global/bin:/home/sam/.rvm/rubies/ruby-2.2.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/sam/.rvm/bin:/home/sam/.rvm/bin:/home/sam/.rvm/bin`. Heroku is working and the error's gone. Don't know how heroku can be working without being in the path but whatever. – neanderslob Feb 18 '16 at 12:25
  • Ah, heroku must be working while being in the path because it's not installed to my home directory. ...wonder why heroku dropped that into my .bashrc when it wasn't necessary – neanderslob Feb 18 '16 at 12:31
0

To solve it I just changed in my .profile file:

PATH="$HOME/bin:$HOME/.local/bin:$PATH"

to

PATH="$PATH:$HOME/bin:$HOME/.local/bin"
Albert Català
  • 2,026
  • 2
  • 29
  • 35