While installing RVM, it is returning a WARNING: Above files contains PATH= with no $PATH inside, this can break RVM

Viewed 284

The problem explanation

I am running OS X for Apple Silicon - Mac M1, using .zshrc shell (not bash), and trying to install RVM following the below instructions to contribute to the open-source project:

  1. Install gpg using Homebrew to verify the integrity of the RVM installer. brew install gpg brew doctor And got Your system is ready to brew. which seems that I successfully added it.

  2. Download the public key for the RVM installer. gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB and I am not getting any error, also seems to be successful.

  3. To install RVM and the latest version of ruby and rails, which is probably a good idea, use the following command. \curl -sSL https://get.rvm.io | bash -s stable --autolibs=enable which is returning the following with *Warning at the end:

Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc
gpg: Signature made Fri Jan 15 23:46:22 2021 +05
gpg:                using RSA key 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: Good signature from "Piotr Kuczynski <piotr.kuczynski@gmail.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 7D2B AF1C F37B 13E2 069D  6956 105B D0E7 3949 9BDB
GPG verified '/Users/sarvarkhalimov/.rvm/archives/rvm-1.29.12.tgz'
Upgrading the RVM installation in /Users/sarvarkhalimov/.rvm/
    RVM PATH line found in /Users/sarvarkhalimov/.mkshrc /Users/sarvarkhalimov/.profile /Users/sarvarkhalimov/.bashrc /Users/sarvarkhalimov/.zshrc.
    RVM sourcing line found in /Users/sarvarkhalimov/.profile /Users/sarvarkhalimov/.bash_profile /Users/sarvarkhalimov/.zshrc /Users/sarvarkhalimov/.zlogin.
Upgrade of RVM in /Users/sarvarkhalimov/.rvm/ is complete.
/Users/sarvarkhalimov/.bash_profile:2:export PATH=/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
/Users/sarvarkhalimov/.bash_profile:5:export PATH=/opt/homebrew/bin:/opt/homebrew/bin:/Users/sarvarkhalimov/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3@global/bin:/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sarvarkhalimov/.rvm/bin:/Users/sarvarkhalimov/.rvm/bin
/Users/sarvarkhalimov/.bash_profile:6:export PATH=/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/Users/sarvarkhalimov/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3@global/bin:/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sarvarkhalimov/.rvm/bin:/Users/sarvarkhalimov/.rvm/bin
/Users/sarvarkhalimov/.bash_profile:7:export PATH=/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/Users/sarvarkhalimov/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3@global/bin:/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sarvarkhalimov/.rvm/bin:/Users/sarvarkhalimov/.rvm/bin

  * WARNING: Above files contains PATH= with no $PATH inside, this can break RVM,
    for details check https://github.com/rvm/rvm/issues/1351#issuecomment-10939525
    to avoid this warning prepend $PATH


Thanks for installing RVM 
Please consider donating to our open collective to help us maintain RVM.

  Donate: https://opencollective.com/rvm/donate
  1. As a final step to verify that everything went well. type rvm | head -1 which shall return rvm is a function. But, I am getting rvm is a shell function from /Users/sarvarkhalimov/.rvm/scripts/cli

My script (source) files

1. ~/.bash_profile

source ~/.profile
export PATH=/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

export PATH=/opt/homebrew/bin:/opt/homebrew/bin:/Users/sarvarkhalimov/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3@global/bin:/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sarvarkhalimov/.rvm/bin:/Users/sarvarkhalimov/.rvm/bin
export PATH=/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/Users/sarvarkhalimov/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3@global/bin:/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sarvarkhalimov/.rvm/bin:/Users/sarvarkhalimov/.rvm/bin
export PATH=/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/Users/sarvarkhalimov/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3@global/bin:/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sarvarkhalimov/.rvm/bin:/Users/sarvarkhalimov/.rvm/bin
export PATH="/usr/local/bin:$PATH"

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

2. ~/.bashrc

export PATH="$PATH:$HOME/.rvm/bin"

3. ~/.zshrc

eval "$(rbenv init -)"

export PATH="/opt/homebrew/bin:$PATH"
export PATH="/usr/local/bin:$PATH"

export PATH="$PATH:$HOME/.rvm/bin"

Taken actions to resolve it:

I came across the following solution by @elado back in 2012, and I tried to change my first export PATH export PATH="$PATH:$HOME/.rvm/bin" to export PATH=$PATH:"$PATH:$HOME/.rvm/bin" but I am still getting the same output with same *warning when I run \curl -sSL https://get.rvm.io | bash -s stable --autolibs=enable.

So, could anyone advise how I can resolve the issues (in my view) in steps number 3 and 4?

Originally posted by @SarvarKh in https://github.com/rvm/rvm/issues/1351#issuecomment-956250296

EDIT #1

*Warning at step number 3 was resolved after pretending $PATH: in .bash_profile. Updated .bash_profile file:

source ~/.profile
export PATH=$PATH:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

export PATH=$PATH:/opt/homebrew/bin:/opt/homebrew/bin:/Users/sarvarkhalimov/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3@global/bin:/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sarvarkhalimov/.rvm/bin:/Users/sarvarkhalimov/.rvm/bin

export PATH=$PATH:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/Users/sarvarkhalimov/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3@global/bin:/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sarvarkhalimov/.rvm/bin:/Users/sarvarkhalimov/.rvm/bin

export PATH=$PATH:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/Users/sarvarkhalimov/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3@global/bin:/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sarvarkhalimov/.rvm/bin:/Users/sarvarkhalimov/.rvm/bin

export PATH="/usr/local/bin:$PATH"

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

!However

I am still getting rvm is a shell function from /Users/sarvarkhalimov/.rvm/scripts/cli after running type rvm | head -1 instead of getting rvm is a function

1 Answers

The issue was composed of the followings:

1. Prepend $PATH: in .bash_profile. So, my .bash_profile looks like this now (perhaps, it can be cleaned up, but not sure. If you know how to do it, please let me know in the comments or leave a link).

    source ~/.profile
    export PATH=$PATH:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
    
    export PATH=$PATH:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3@global/bin:/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sarvarkhalimov/.rvm/bin:/Users/sarvarkhalimov/.rvm/bin
    
    export PATH=$PATH:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3@global/bin:/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sarvarkhalimov/.rvm/bin:/Users/sarvarkhalimov/.rvm/bin
    
    export PATH=$PATH:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3@global/bin:/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sarvarkhalimov/.rvm/bin:/Users/sarvarkhalimov/.rvm/bin
    
    export PATH="/usr/local/bin:$PATH"
    
    [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
    export PATH="/opt/homebrew/bin:$PATH"

2. I had rbenv, installed sometime back, which is another ruby version manager. So, I had to uninstall it following those steps. *Note: while deleting any lines with rbenv, please delete only the part relevant to rbenv, not the whole line itself.

For instance, delete /Users/sarvarkhalimov/.rbenv/shims: from:

export PATH=$PATH:/opt/homebrew/bin:/opt/homebrew/bin:/Users/sarvarkhalimov/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3@global/bin:/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sarvarkhalimov/.rvm/bin:/Users/sarvarkhalimov/.rvm/bin

3. I did change my default shell terminal from zsh to bash running chsh -s /bin/bash.


RVM successful installation verification.

Finally, it is returning rvm is a function when you run type rvm | head -1 as was supposed to.

Related