Mac High Sierra 10.13安装Ruby on Rails时提示‘-bash: rvm: command not found’
Hey there, I’ve dealt with this exact issue plenty of times when setting up Ruby on Rails on older macOS versions. Let’s walk through getting RVM working properly:
First, Verify RVM is Actually Installed
Before we tweak shell settings, let’s confirm RVM was installed successfully. Run this command in your terminal:
ls ~/.rvm
If you see folders like bin, scripts, and rubies, that means RVM is on your system—it just isn’t being loaded by your shell yet.
Load RVM Into Your Bash Shell
Mac High Sierra uses bash by default, so we need to add RVM’s initialization code to your shell’s config file. Here’s how:
- Open your bash profile in a text editor (nano is simple for terminal newbies):
nano ~/.bash_profile
- Paste these two lines at the bottom of the file:
export PATH="$PATH:$HOME/.rvm/bin" [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Save the file by pressing
Ctrl + O, then hit Enter to confirm the filename. Exit nano withCtrl + X.Make the changes take effect immediately without restarting your terminal:
source ~/.bash_profile
Test It Out
Now run the check command again:
rvm | head -n 1
You should see output like rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin (version number might vary).
If It Still Doesn’t Work
- Try closing and reopening your terminal (or iTerm, if you use that)—sometimes shell sessions hold onto old configs.
- If you accidentally use a different shell (like zsh), you’ll need to add those same lines to
~/.zshrcinstead. - If the
ls ~/.rvmcommand showed nothing, your initial RVM install probably failed. Re-run the install command and watch for error messages:
\curl -L https://get.rvm.io | bash -s stable
内容的提问来源于stack exchange,提问作者Leo Tyndall

