rvm 安裝 ruby 之後,必須執行 /bin/bash --login 才能執行 ruby 命令
阿新 • • 發佈:2019-02-09
安裝ruby以後執行
rvm use 2.3.0 --default
錯誤資訊:
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration /gnome-terminal/ for an example.
解決辦法:
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >>~/.bashrc
source ~/.bashrc
ruby -v
ps:
- /etc/profile:此檔案為系統的每個使用者設定環境資訊,當用戶第一次登入時,該檔案被執行.
並從/etc/profile.d目錄的配置檔案中搜集shell的設定. - /etc/bashrc:為每一個執行bash shell的使用者執行此檔案.當bash shell被開啟時,該檔案被讀取.
- ~/.bash_profile:每個使用者都可使用該檔案輸入專用於自己使用的shell資訊,當用戶登入時,該檔案僅僅執行一次!預設情況下,他設定一些環境變數,執行使用者的.bashrc檔案.
- ~/.bashrc:該檔案包含專用於你的bash shell的bash資訊,當登入時以及每次開啟新的shell時該檔案被讀取.
- ~/.bash_logout:當每次退出系統(退出bash shell)時,執行該檔案.