2

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

Sarvar Khalimov
  • 455
  • 5
  • 11
  • Hope this question will help many macOS users willing to install RVM because I have encountered this issue and have not been able to figure it out for while now. I had created an issue in the RVM repo in GitHub, but no reply was received yet. – Sarvar Khalimov Nov 02 '21 at 13:09
  • 1
    I think the warning is fairly clear. Since the first 4 do not contain $PATH you are actually just overwriting the PATH variable over and over rather than extending it. e.g. `export HELLO=1 && export HELLO=2 && echo $HELLO # 2` because the second export overwrites the first but `export HELLO=1 && export HELLO=$HELLO:2 && echo $HELLO # 1:2` because the second export prepends the system variable `$HELLO` – engineersmnky Nov 02 '21 at 13:21
  • @engineersmnky thanks. I have resolved that Warning at step #3. 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`. Any ideas? – Sarvar Khalimov Nov 02 '21 at 15:40
  • 1
    `rvm is a shell function from ...` sounds right to me. I don't think you should have problems using it with that. However you should really clean up your `PATH` definitions in your `bash_profile`. You're inserting the same path multiple times into your `PATH` variable now. Try `echo $PATH` from the command line and you will see. I suggest to remove the duplicates from your `bash_profile` to clean it up. – Casper Nov 03 '21 at 06:21
  • @Casper thanks for your reply. I changed my default shell on the terminal from `zsh` to `bash` running `chsh -s /bin/bash`. After that, I realized that I had rbenv installed some time back in the past as well which was causing $PATH issues, I believe. So after uninstalling it and rerunning step 5 mentioned in the question, I successfully installed and got `rvm is a function` after running `type rvm | head -1`. phew) – Sarvar Khalimov Nov 03 '21 at 08:04

1 Answers1

0

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.

Sarvar Khalimov
  • 455
  • 5
  • 11
  • This must help, if not please leave a comment. I will try to help and respond as fast as I can, I kind of became master in installing RVM on macOS) – Sarvar Khalimov Nov 03 '21 at 09:04