警告! PATH 设置不正确,/Users/me/.rvm/gems/ruby-2.7.3/bin 不在首位
Posted
技术标签:
【中文标题】警告! PATH 设置不正确,/Users/me/.rvm/gems/ruby-2.7.3/bin 不在首位【英文标题】:Warning! PATH is not properly set up, /Users/me/.rvm/gems/ruby-2.7.3/bin is not at first place 【发布时间】:2021-12-18 17:36:04 【问题描述】:说明
当我运行 rvm -v
时,我仍然收到下面给出的警告。
Warning! PATH is not properly set up, /Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.7.3
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
rvm 1.29.12-next (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
虽然在我看来 RVM 在type rvm | head -1
返回rvm is a function
后安装成功。
重现步骤
我将 OS X 用于 Apple Silicon - Mac M1,并使用 bash 作为默认 shell。 所以,我安装了默认的 Ruby 并安装了 Git,用 homebrew 重新安装它们。
.bash_profile
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"
export PATH="/opt/homebrew/bin:$PATH"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
.zshrc(如果需要)。
eval "$(rbenv init -)"
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="/opt/homebrew/bin:$PATH"
export PATH="/usr/local/bin:$PATH"
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
.bashrc
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
并尝试按照下列步骤安装 RVM:
使用 Homebrew 安装 gpg 以验证 RVM 安装程序的完整性。
brew install gpg
brew doctor
并得到了Your system is ready to brew.
,看来我添加成功了。
下载 RVM 安装程序的公钥。
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
而且我没有收到任何错误,似乎也成功了。
要安装 RVM 和最新版本的 ruby 和 rails,这可能是个好主意,请使用以下命令。
\curl -sSL https://get.rvm.io | bash -s stable --autolibs=enable
返回以下内容(似乎没问题):
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/.zlogin.
Upgrade of RVM in /Users/sarvarkhalimov/.rvm/ is complete.
Thanks for installing RVM ????
Please consider donating to our open collective to help us maintain RVM.
???? Donate: https://opencollective.com/rvm/donate
-
作为验证一切顺利的最后一步。
type rvm | head -1
返回rvm is a function
。
这证实了根据rvm.oi documentation 安装成功。
预期行为
当我运行rvm -v
时,至少,我期望顶部描述部分不会显示警告,下面也简要给出:
Warning! PATH is not properly set up, /Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin is not at first place.
实际行为
我想我在上面的重现步骤部分中包含了它。
调试模式:
我已经尝试了issue 或*** 中给出的解决方案,但我仍然无法解决这个$PATH warning
。
环境信息
运行rvm info
返回:
Warning! PATH is not properly set up, /Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.7.3
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
ruby-2.7.3:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
system:
uname: "Darwin Sarvars-MacBook-Air.local 20.6.0 Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:38 PDT 2021; root:xnu-7195.141.8~1/RELEASE_ARM64_T8101 arm64"
name: "OSX"
version: "11.6"
architecture: "arm64"
bash: "/bin/bash => GNU bash, version 3.2.57(1)-release (arm64-apple-darwin20)"
zsh: "/bin/zsh => zsh 5.8 (x86_64-apple-darwin20.0)"
remote_path: "osx/11.6/arm64"
xcode: ""
rvm:
version: "1.29.12 (latest)"
updated: "13 minutes 4 seconds ago"
path: "/Users/sarvarkhalimov/.rvm"
autolibs: "[enable] Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."
ruby:
interpreter: "ruby"
version: "2.7.3p183"
date: "2021-04-05"
platform: "arm64-darwin20"
patchlevel: "2021-04-05 revision 6847ee089d"
full_version: "ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [arm64-darwin20]"
homes:
gem: "/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3"
ruby: "/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3"
binaries:
ruby: "/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin/ruby"
irb: "/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin/irb"
gem: "/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/bin/gem"
rake: "/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3/bin/rake"
environment:
PATH: "/opt/homebrew/bin:/usr/local/bin:/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:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/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:/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:/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"
GEM_HOME: "/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3"
GEM_PATH: "/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3:/Users/sarvarkhalimov/.rvm/gems/ruby-2.7.3@global"
MY_RUBY_HOME: "/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3"
IRBRC: "/Users/sarvarkhalimov/.rvm/rubies/ruby-2.7.3/.irbrc"
RUBYOPT: ""
gemset: ""
提前致谢!我也在 rvm repo 上创建了一个 issue。
【问题讨论】:
【参考方案1】:解决方案
我找到了解决方案here,其中说明如下:
我在使用 Mac OS 10.14.6 和 RVM 1.29.9 时遇到了类似的错误。
对我来说,通过将我的
.bash_profile
中的以下代码移动到文件底部来解决问题:# RVM can encounter errors if it's not the last thing in .bash_profile export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to path for scripting (to manage Ruby versions) export PATH="$GEM_HOME/bin:$PATH" [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
【讨论】:
以上是关于警告! PATH 设置不正确,/Users/me/.rvm/gems/ruby-2.7.3/bin 不在首位的主要内容,如果未能解决你的问题,请参考以下文章
Xcode 服务器机器人问题:警告。构建服务错误。问题:路径 'some/path' 的存档格式不正确