簡體   English   中英

RVM正在加載錯誤版本的ruby?

[英]RVM is loading with the wrong version of ruby?

當我打開終端時,我看到:

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的地方。 如果我輸入:

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個人資料:

# 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

有什么幫助嗎? 謝謝

在命令提示符下運行ruby -v時,實際上是在運行/usr/bin/ruby因為您在$PATH env變量的第一個設置了/usr/bin 您應該將以下rvm initialize命令移至bash配置文件的末尾。

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function

它應該工作。 通過--default標志設置默認紅寶石后, --default在bash配置文件中運行rvm use命令。

您可能應該從bashrc中刪除這些行:

# Sets the RVM profile on terminal load
rvm use ruby-1.9.3-p125
rvm use 1.9.3 --default

當您打開終端時,rvm應該會自動加載其默認配置文件,因此無需在bashrc中設置(並出於某種原因重新設置)版本。

--default選項僅需要使用一次,以指示所選版本從那時起為默認版本。

嘗試使用rvm alias create default 1.9.3

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM