问题描述
当我打开终端我看到:
Last login: Sun Aug 26 15:33:57 on ttys001
Using /Users/me/.rvm/gems/ruby-1.9.3-p125
Running /Users/me/.rvm/hooks/after_use
Using /Users/me/.rvm/gems/ruby-1.9.3-p194
ruRunning /Users/me/.rvm/hooks/after_use
me-MacBook:site me$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
我想要红宝石1.9.3。如果我然后键入:
Where I want ruby 1.9.3. If I then type:
rvm use 1.9.3 --default
我得到如下:
$ rvm use 1.9.3 --default
Using /Users/me/.rvm/gems/ruby-1.9.3-p194
Running /Users/me/.rvm/hooks/after_use
这允许我使用导轨但是当我重新打开终端我必须做这每一次。有没有办法让这个默认设置?我把它添加到我的.bash_profile,但似乎并没有工作。这里是我的bash的个人资料:
This allows me to use rails but when I reopen terminal I have to do this every single time. Is there a way to make this the default setting? I added it to my bash_profile but that does not seem to work. Here is my bash profile:
# Required for Ruby upgrade to 1.9.3
export RUBYOPT=-r openssl
export PATH=${PATH}:/opt/local/bin
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
# Sets the RVM profile on terminal load
rvm use ruby-1.9.3-p125
rvm use 1.9.3 --default
# RVM Requirements
export CC="/usr/local/bin/gcc-4.2"
export CFLAGS="-O2 -arch x86_64"
export LDFLAGS="-L/opt/local/lib"
export CPPFLAGS="-I/opt/local/include"
export ARCHFLAGS="-arch i386"
# Postgresql
export PATH=/usr/bin:$PATH
任何帮助吗?谢谢
Any help? Thanks
推荐答案
当您运行红宝石-v
在命令提示符下,你实际上是运行在/ usr /斌/红宝石
,因为你设置的/ usr / bin中
中的第一个 $ PATH的
环境变量。你应该将以下RVM初始化命令来砸轨迹的终点。
When you run ruby -v
in command prompt, you are actually running /usr/bin/ruby
because you set /usr/bin
in very first of $PATH
env variable. You should move the following rvm initialize command to the end of bash profile.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
它应该工作。你并不需要在您的bash配置文件中运行 RVM使用
命令后,可以通过设置默认红宝石 - 默认
标志
这篇关于RVM加载与错误的版本红宝石?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!