title: RVM settings lost after logout
body: <p>I have RVM and Ruby installed on OS X. I set the default version using:</p>
  
  <pre><code>rvm use 1.9.3-p194 --default
  </code></pre>
  
  <p>But this works only for the current terminal session. When I start a new session, <code>ruby -v</code> returns my System's Ruby version.</p>
  
  <p>Any hints?</p>
  
  <p><strong>UPD</strong></p>
  
  <pre><code>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 =&gt; GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)"
      zsh:         "/bin/zsh =&gt; zsh 4.3.11 (i386-apple-darwin12.0)"
  
    rvm:
      version:      "rvm 1.18.5 (stable) by Wayne E. Seguin &lt;wayneeseguin@gmail.com&gt;, Michal Papis &lt;mpapis@gmail.com&gt; [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/ruby-1.9.3-p194@global/bin/rake"
  
    environment:
      PATH:         "/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/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/ruby-1.9.3-p194@global"
      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:       ""
  </code></pre>
  
  <p><strong>After logging in:</strong></p>
  
  <pre><code>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 =&gt; GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)"
      zsh:         "/bin/zsh =&gt; zsh 4.3.11 (i386-apple-darwin12.0)"
  
    rvm:
      version:      "rvm 1.18.5 (stable) by Wayne E. Seguin &lt;wayneeseguin@gmail.com&gt;, Michal Papis &lt;mpapis@gmail.com&gt; [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:       ""
  </code></pre>
  
  <p><strong>UPD2</strong></p>
  
  <pre><code>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" ]] &amp;&amp; source "/usr/local/rvm/scripts/rvm" # Load RVM into a shell session *as a function*
  </code></pre>
  
  <p><strong>UPD3</strong></p>
  
  <pre><code>/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}"  ]] &amp;&amp; setopt | grep "^${1}$" &gt;/dev/null 2&gt;&amp;1
    } ||
    {
      [[ -n "${BASH_VERSION}" ]] &amp;&amp; [[ ":$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:-}" ]] &amp;&amp; ! [[ "$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" &gt;/dev/null 2&gt;&amp;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" &amp;&amp; -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. %%/ &lt;- 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:-}" ]] &amp;&amp;
    typeset -f rvm &gt;/dev/null 2&gt;&amp;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}" &amp;&amp; -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&gt;/dev/null))"
  
      alias rvm-restart="rvm_reload_flag=1 source '${rvm_scripts_path:-${rvm_path}/scripts}/rvm'"
  
      if ! builtin command -v ruby &gt;/dev/null 2&gt;&amp;1 ||
        builtin command -v ruby | GREP_OPTIONS="" \grep -v "${rvm_path}" &gt;/dev/null ||
        builtin command -v ruby | GREP_OPTIONS="" \grep "${rvm_path}/bin/ruby$" &gt;/dev/null
      then
        if [[ -s "$rvm_environments_path/default" &amp;&amp; "${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 &amp;&amp; ${rvm_project_rvmrc:-1} -gt 0 ]] &amp;&amp;
    rvm_is_a_shell_function no_warning &amp;&amp;
    ! __function_on_stack __rvm_project_rvmrc &amp;&amp;
    typeset -f __rvm_project_rvmrc &gt;/dev/null 2&gt;&amp;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
  </code></pre>