我RVM和在OS X上安裝了Ruby,我設置使用默認版本後丟失:RVM設置註銷
rvm use 1.9.3-p194 --default
但這僅適用於當前的終端會話。當我開始一個新的會話時,ruby -v
返回我的系統的Ruby版本。
任何提示?
UPD
macbook:~ mighter$ rvm info
ruby-1.9.3-p194:
system:
uname: "Darwin macbook.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64"
system: "osx/10.8/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin12.0)"
rvm:
version: "rvm 1.18.5 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]"
updated: "1 hour 22 minutes 16 seconds ago"
ruby:
interpreter: "ruby"
version: "1.9.3p194"
date: "2012-04-20"
platform: "x86_64-darwin12.2.0"
patchlevel: "2012-04-20 revision 35410"
full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0]"
homes:
gem: "/usr/local/rvm/gems/ruby-1.9.3-p194"
ruby: "/usr/local/rvm/rubies/ruby-1.9.3-p194"
binaries:
ruby: "/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby"
irb: "/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/irb"
gem: "/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem"
rake: "/usr/local/rvm/gems/[email protected]/bin/rake"
environment:
PATH: "/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/[email protected]/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin"
GEM_HOME: "/usr/local/rvm/gems/ruby-1.9.3-p194"
GEM_PATH: "/usr/local/rvm/gems/ruby-1.9.3-p194:/usr/local/rvm/gems/[email protected]"
MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-1.9.3-p194"
IRBRC: "/usr/local/rvm/rubies/ruby-1.9.3-p194/.irbrc"
RUBYOPT: ""
gemset: ""
在登錄後:
macbook:~ mighter$ rvm info
system:
system:
uname: "Darwin macbook.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64"
system: "osx/10.8/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin12.0)"
rvm:
version: "rvm 1.18.5 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]"
updated: "1 hour 21 minutes 18 seconds ago"
homes:
gem: "not set"
ruby: "not set"
binaries:
ruby: "/usr/bin/ruby"
irb: "/usr/bin/irb"
gem: "/usr/bin/gem"
rake: "/usr/bin/rake"
environment:
PATH: "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/local/rvm/bin"
GEM_HOME: ""
GEM_PATH: ""
MY_RUBY_HOME: ""
IRBRC: ""
RUBYOPT: ""
gemset: ""
UPD2
macbook:~ mighter$ cat .bashrc
PATH=$PATH:/usr/local/rvm/bin # Add RVM to PATH for scripting
macbook:~ mighter$ cat .bash_profile
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm" # Load RVM into a shell session *as a function*
UPD3
/usr/local/rvm/scripts/rvm
#!/usr/bin/env bash
# rvm : Ruby enVironment Manager
# https://rvm.io
# https://github.com/wayneeseguin/rvm
# also duplicated in scripts/base
__rvm_has_opt()
{
{
[[ -n "${ZSH_VERSION}" ]] && setopt | grep "^${1}$" >/dev/null 2>&1
} ||
{
[[ -n "${BASH_VERSION}" ]] && [[ ":$SHELLOPTS:" =~ ":${1}:" ]]
} ||
return 1
}
# Do not allow sourcing RVM in `sh` - it's not supported
# return 0 to exit from sourcing this script without breaking sh
if __rvm_has_opt "posix"
then return 0
fi
# TODO: Alter the variable names to make sense
\export HOME rvm_prefix rvm_user_install_flag rvm_path
HOME="${HOME%%+(\/)}" # Remove trailing slashes if they exist on HOME
[[ -n "${rvm_stored_umask:-}" ]] || export rvm_stored_umask=$(umask)
if ((${rvm_ignore_rvmrc:=0} == 0))
then
rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc")
if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
then rvm_rvmrc_files+=("${rvm_prefix}/.rvmrc")
fi
for rvmrc in "${rvm_rvmrc_files[@]}"
do
if [[ -f "$rvmrc" ]]
then
if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
then
printf "%b" "
Error:
$rvmrc is for rvm settings only.
rvm CLI may NOT be called from within $rvmrc.
Skipping the loading of $rvmrc"
return 1
else
source "$rvmrc"
fi
fi
done
unset rvm_rvmrc_files
fi
# detect rvm_path if not set
if [[ -z "${rvm_path:-}" ]]
then
if ((UID == 0))
then
if ((${rvm_user_install_flag:-0} == 0))
then
rvm_user_install_flag=0
rvm_prefix="/usr/local"
rvm_path="${rvm_prefix}/rvm"
else
rvm_user_install_flag=1
rvm_prefix="$HOME"
rvm_path="${rvm_prefix}/.rvm"
fi
else
if [[ -d "$HOME/.rvm" && -s "$HOME/.rvm/scripts/rvm" ]]
then
rvm_user_install_flag=1
rvm_prefix="$HOME"
rvm_path="${rvm_prefix}/.rvm"
else
rvm_user_install_flag=0
rvm_prefix="/usr/local"
rvm_path="${rvm_prefix}/rvm"
fi
fi
else
# remove trailing slashes, btw. %%/ <- does not work as expected
rvm_path="${rvm_path%%+(\/)}"
fi
# guess rvm_prefix if not set
if [[ -z "${rvm_prefix}" ]]
then
rvm_prefix=$(dirname $rvm_path)
fi
# guess rvm_user_install_flag if not set
if [[ -z "${rvm_user_install_flag}" ]]
then
if [[ "${rvm_prefix}" == "${HOME}" ]]
then
rvm_user_install_flag=1
else
rvm_user_install_flag=0
fi
fi
export rvm_loaded_flag
if [[ -n "${BASH_VERSION:-}" || -n "${ZSH_VERSION:-}" ]] &&
typeset -f rvm >/dev/null 2>&1
then
rvm_loaded_flag=1
else
rvm_loaded_flag=0
fi
if ((${rvm_loaded_flag:=0} == 0)) || ((${rvm_reload_flag:=0} == 1))
then
if [[ -n "${rvm_path}" && -d "$rvm_path" ]]
then
true ${rvm_scripts_path:="$rvm_path/scripts"}
if [[ -f "$rvm_scripts_path/base" ]]
then
source "$rvm_scripts_path/base"
else
printf "%b" "WARNING:
Could not source '$rvm_scripts_path/base' as file does not exist.
RVM will likely not work as expected.\n"
fi
__rvm_ensure_is_a_function
__rvm_setup
export rvm_version
rvm_version="$(cat "$rvm_path/VERSION") ($(cat "$rvm_path/RELEASE" 2>/dev/null))"
alias rvm-restart="rvm_reload_flag=1 source '${rvm_scripts_path:-${rvm_path}/scripts}/rvm'"
if ! builtin command -v ruby >/dev/null 2>&1 ||
builtin command -v ruby | GREP_OPTIONS="" \grep -v "${rvm_path}" >/dev/null ||
builtin command -v ruby | GREP_OPTIONS="" \grep "${rvm_path}/bin/ruby$" >/dev/null
then
if [[ -s "$rvm_environments_path/default" && "${rvm_action}" != "switch" ]]
then
source "$rvm_environments_path/default"
elif [[ -s "$rvm_path/environments/default" ]]
then
source "$rvm_path/environments/default"
fi
fi
# Makes sure rvm_bin_path is in PATH atleast once.
__rvm_conditionally_add_bin_path
if ((${rvm_reload_flag:=0} == 1))
then
[[ "${rvm_auto_reload_flag:-0}" == 2 ]] || printf "%b" 'RVM reloaded!\n'
# make sure we clean env on reload
__rvm_env_loaded=1
unset __rvm_project_rvmrc_lock
fi
rvm_loaded_flag=1
else
printf "%b" "\n\$rvm_path ($rvm_path) does not exist."
fi
unset rvm_prefix_needs_trailing_slash rvm_gems_cache_path \
rvm_gems_path rvm_project_rvmrc_default rvm_gemset_separator rvm_reload_flag
else
source "${rvm_scripts_path:="$rvm_path/scripts"}/initialize"
__rvm_setup
fi
if [[ -t 0 && ${rvm_project_rvmrc:-1} -gt 0 ]] &&
rvm_is_a_shell_function no_warning &&
! __function_on_stack __rvm_project_rvmrc &&
typeset -f __rvm_project_rvmrc >/dev/null 2>&1
then
# Reload the rvmrc, use promptless ensuring shell processes does not
# prompt if .rvmrc trust value is not stored.
rvm_promptless=1 __rvm_project_rvmrc
rvm_hook=after_cd
source "${rvm_scripts_path:-${rvm_path}/scripts}/hook"
fi
__rvm_teardown
當你打開一個新shell時,rvm list的輸出是什麼?另外,看看這裏:http://stackoverflow.com/questions/5604877/why-doesnt-rvm-default-work-for-me-on-macosx –
不是一個真正的答案,但我開始有同樣的確切問題並決定使用該時間切換到[rbenv](https://github.com/sstephenson/rbenv/)。從那以後一直沒有回頭。 –
請將'rvm info'的輸出附加到您的問題中。 –