Home Php C# Sql C C++ Javascript Python Java Go Android Git Linux Asp.net Django .net Node.js Ios Xcode Cocoa Iphone Mysql Tomcat Mongodb Bash Objective-c Scala Visual-studio Apache Elasticsearch Jar Eclipse Jquery Ruby-on-rails Ruby Rubygems Android-studio Spring Lua Sqlite Emacs Ubuntu Perl Docker Swift Amazon-web-services Svn Html Ajax Xml Java-ee Maven Intellij-idea Rvm Macos Unix Css Ipad Postgresql Css3 Json Windows-server Vue.js Typescript Oracle Hibernate Internet-explorer Github Tensorflow Laravel Symfony Redis Html5 Google-app-engine Nginx Firefox Sqlalchemy Lucene Erlang Flask Vim Solr Webview Facebook Zend-framework Virtualenv Nosql Ide Twitter Safari Flutter Bundle Phonegap Centos Sphinx Actionscript Tornado Register | Login | Edit Tags | New Questions | 繁体 | 简体


9 questions online user: 25

35
votes
answers
55 views
+10

Relationships between Rubygems, Bundler, and RVM

Following current best practices, what is the proper role for each of these?

Based on my limited understanding of Bundler and RVM, it seems that they--like Rubygems--have their own install locations for gems. Plus, for each one, there's the option of installing to system paths using sudo or to your home directory. And then there's the ability to vendor gems with Bundler (where applicable, e.g. with Rails).

So it looks to me like there are at least seven places to install gems now:

  • Rubygems system path
  • Rubygems user path
  • RVM system path
  • RVM user path
  • Bundler system path
  • Bundler user path
  • Vendor (per-app)

So, what's the best way to manage all this? Do we use all three (Rubygems, Bundler, RVM) and tell them all to install gems to the same place? Do we use sudo all the time, some of the time, or never? And should we be using a different strategy on production and development machines?

On a related note, are Bundler and RVM wrappers around Rubygems, are they alternatives to it, or are they completely orthogonal to it?

up vote 32 down vote accepted favorite
沙发
+320
+50

來自Bundler的網站

Bundler可以輕鬆確保您的應用程序具有啟動和運行所需的依賴項,而不會出現錯誤。

這意味著,對於其他開發人員或您在另一台計算機上,準備進一步開發或使用它,通過運行bundle install並且您擁有啟動和運行所需的一切,這是微不足道的

RVM用於在同一台機器上管理多個版本的Ruby,並在它們之間進行切換。Gemsets是RVM提供的一項強大功能,可將一個應用程序/庫的gem與系統的其餘部分隔離開來。

當一起使用RVM和Bundler時,RVM告訴Bundler gem應該去哪裡,Bundler將它們安裝到RVM文件夾中。

兩者(關於RVM中的gems)使用並依賴於Rubygems,因此它們最接近包裝器。

我個人使用Bundler和RVM來完成我的所有項目。沒有gemsets,只有Bundler來解決和修復問題,它確實沒有失敗。安裝gems沒有sudo,最終在RVM定義的地方。我的系統上的默認Ruby安裝是獨立的,並且沒有任何內容安裝到Rubygems系統/用戶路徑

when rvm is installed, how is rvm telling bundler, where to install gems ? – Anand Jan 5 '11 at 12:34

without RVM, bundler installs the gems into the default system location for gems (for example /usr/lib/ruby/gems, which is the default on my Gentoo-box). RVM tells Bundler where to install by providing the GEM_HOME environment variable. – PerfectlyNormal Jan 5 '11 at 16:37

no, never found anything that really needed it. – PerfectlyNormal Dec 5 '10 at 23:34

your answer was very clear. but when rvm is not installed, where will bundler install the gems. – Anand Jan 5 '11 at 12:34

Do you use sudo/rvmsudo? – rlkw1024 Dec 5 '10 at 23:29

+30

我現在這樣做的方式(雖然仍在嘗試一下)是這樣的:

  1. Use RVM to set up the ruby version and a gemset to use for an app. I use an .rvmrc-file in the root of the app directory to make sure the correct ruby and gemset is used all the time.

  2. Bundler is installed using gem without sudo in the given gemset.

  3. Any gems needed by the app is added to the apps Gemfile and installed using Bundler. I'm not using sudo for this.

This way I use Bundler to keep track of the dependencies for each app, and RVM to isolate each app's gems from each other. Works really smooth, actually.

I have not yet installed RVM on my deployment server, there I just use Bundler to make sure each apps dependecies are handled. I will probably install RVM there as well, but have to figure out how that plays ball with Passenger first.

As for your last question, Bundler is a wrapper around gem, RVM just manipulates the gempath where gems are installed. It seems to be smart enough that it picks up the gems from the same place though so I don't need to recompile any that are already installed in some other gemset.

I've stopped using sudo for installing gems after starting to use RVM. There's really no reason over just installing them in the rvm user path. I'm unsure about the best practice if you have more developers on the same machine like a test server or something like that.

Gemsets are RVM-only. Bundler is unaware of anything different. You can either switch manually, or add a .rvmrc-file ( docs ) that takes care of it. You should read the documentation for Gemsets for more details – PerfectlyNormal Dec 6 '10 at 0:59

Thanks! Do you switch to the right gemset when you go to work on a certain application, or can Bundler handle that for you? – rlkw1024 Dec 5 '10 at 23:25

A gemset starts out empty, completely separate from the rest of the system. Bundler and the Gemfile still do the same thing, but installed into the gemset instead of globally. – PerfectlyNormal Dec 5 '10 at 23:17

"Use RVM to set up the ruby version and a gemset to use for an app"--How does this gemset interact with the Gemfile and Bundler? – rlkw1024 Dec 5 '10 at 23:11

0
votes
answers
72 views
+10

如何在Xcode中構建項目Ruby?

5

我有一個關於Mac上的Ruby的問題。當我bulid項目,有一個錯誤如下:如何在Xcode中構建項目Ruby?

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- plist (LoadError) 

from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require' 
    from .../app.build/Debug-iphonesimulator/iphone.build/Script-2095E433129114D900424894.sh:3 
Command /bin/sh failed with exit code 1 

的Xcode 4.3.3安裝在我的電腦,它使用的是Mac OS X 10.7.4上,我安裝了Ruby 1.9.3與RVM並設置作爲默認的紅寶石1.9.3:

$ rvm use 1.9.3 

Using ../.rvm/gems/ruby-1.9.3-p194 

$ ruby -v 

ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0] 

有人知道解決方案來解決這個問題嗎?

+1

嗨,我有完全相同的問題。我遵循這個教程:http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/,它的工作。 – 2012-07-12 09:51:49

+1

非常感謝你,這意味着我應該卸載Xcode,RMVM,紅寶石,並重新安裝它們? – user1520033 2012-07-12 15:03:14

+0

這就是我所要做的。等待其他答案,也許還有另一種解決方案。 – 2012-07-12 15:12:20

沙发
0
0

您可能需要在Xcode中安裝命令行工具?我認爲你打開Xcode,進入首選項並在那裏,你可以安裝命令行工具。之後你可能需要重新編譯你的rvm ruby??。

68
votes
answers
49 views
+10

How can I remove RVM (Ruby Version Manager) from my system?

How can I remove RVM (Ruby Version Manager) from my system?

沙发
+280

When using implode and you see:

Psychologist intervened, cancelling implosion, crisis avoided :)

Then you may want to use --force

rvm implode --force

Then remove rvm from following locations:

rm -rf /usr/local/rvm
sudo rm /etc/profile.d/rvm.sh
sudo rm /etc/rvmrc
sudo rm ~/.rvmrc

Check the following files and remove or comment out references to rvm

~/.bashrc 
~/.bash_profile 
~/.profile 
~/.zshrc
~/.zlogin

Comment-out / Remove the following lines from /etc/profile

 source /etc/profile.d/sm.sh
 source /etc/profile.d/rvm.sh

/etc/profile is a readonly file so use

sudo vim /etc/profile

And after making the change write using a bang!

:w!

Finally re-login / restart your terminal.

板凳
+170

In addition to @tadman's answer I removed the wrappers in /usr/local/bin as well as the file /etc/profile.d/rvm.

The wrappers include:

erb
gem
irb
rake
rdoc
ri
ruby
testrb
地板
+70

A lot of people do a common mistake of thinking that 'rvm implode' does it . You need to delete all traces of any .rm files . Also , it will take some manual deletions from root . Make sure , it gets deleted and also all the ruby versions u installed using it .

4楼
+60

Remove the RVM load script from /.bash_rc or /.zsh_rc, then use:

rm -rf /.rvm

Or:

rvm implode
5楼
+40

Run the following command

rvm implode

Now you need to unistall the rvm gem:

gem uninstall rvm

Check if there are any remaining rvm files in your home directory, if yes remove them.

Go to the home directory and list all hidden files

ls -a

rm  .rvm
rm  .rvmrc
6楼
+30

Note that if you installed RVM via apt-get, you have to run some further steps than rvm implode or apt-get remove ruby-rvm to get it to really uninstall.

See "Installing RVM on Ubuntu".

您可以使用與map方法類似的技巧:array.map(&:price).inject(:+) - markquezada 2011年9月8日在2:58

array.map(&:price).inject(0,:+)更安全一些。它確保如果你有一個空列表,你得到0而不是零。 - 約翰夫2011年10月4日9:21

使用array.map(...)。inject(...)是低效的,你將遍歷所有數據兩次。嘗試array.inject(0){| sum,product | sum + = product.price} - everett1992 2013年4月4日6:11

7楼
+20

If you're still getting a env: ruby_executable_hooks: No such file or directory when calling some Ruby package, that means RVM left a little gift for you in your $PATH.

Run the following to find the offending scripts:

grep '#!/usr/bin/env ruby_executable_hooks' /usr/local/bin/*

Then rm all the matches. You'll have to reinstall all of those libraries with an RVM-free gem, of course.

我同意,reduce告訴我更多關於函數的功能,但是注入確實聽起來更酷。 - everett1992 2013年4月4日6:13

同意最後的評論,你給了我最好的答案。 - Jerska 2013年11月11日19:13

我要做的一個評論是在MapReduce之前減少和映射為高階函數。靈感以另一種方式運行。而在MapReduce意義上,它與簡單的功能減少有些不同,對不同機器的通信方式有影響。 - acjay 2015年4月13日14:01

Ken Iverson在編程語言APL中引入了操作符/稱為“簡化運算符”。資料來源:艾弗森,肯尼思。1962年。一種編程語言。威利。另一個來源:“作為思想工具的符號”,1979年ACM圖靈獎演講,Kenneth E. Iverson,dl.acm.org / ft_gateway.cfm?id = 1283935&type = pdf - Fernando Pelliccioni 2016年7月25日1:50

8楼
+10

For other shell newbies trying to fix the PATH variable

After following instructions in accepted answer, check and modify your PATH variable if necessary :

env | grep PATH 

if you see "rvm" anywhere, you need to figure out where you are setting PATH and modify. I was setting it in 3 files - so check all the following files:

vim .bashrc  

Delete the lines in the file referencing rvm using the dd command. :wq to save and exit.
source .bashrc to "reload"

Repeat this process (starting with the vim command) for .profile and .bash_profile

較新版本的activesupport默認情況下不會實際加載所有擴展。您只需要求sum模塊:require'active_support / core_ext / enumerable.rb',或者需要所有主動支持:require'active_support / all'。更多相關信息:API Docs - Dylan Cashman 2012年3月21日20:42

不要緊,activesupport是拖延到項目中從array.inject(:+)到array.sum的大量依賴。 - meagar•2016年2月11日13:29

Nitpick給出了一個好的評論:它應該是'active_support / core_ext / enumerable'而沒有.rb後綴,因為這是隱式添加的。 - Per Lundberg 2016年7月6日14:34

254
votes
answers
60 views
+10

Curl Certificate Error when Using RVM to install Ruby 1.9.2

RVM is running into a certificate error when trying to download Ruby 1.9.2. It looks like curl is having a certificate issue but I am not sure how to bypass it. I have included the exact error info below.

$ rvm install 1.9.2
Installing Ruby from source to: /Users/willdennis/.rvm/rubies/ruby-1.9.2-p180, this may take a while depending on your cpu(s)...

ruby-1.9.2-p180 - #fetching 
ERROR: Error running 'bunzip2 '/Users/willdennis/.rvm/archives/ruby-1.9.2-p180.tar.bz2'', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/extract.log
ruby-1.9.2-p180 - #extracting ruby-1.9.2-p180 to /Users/willdennis/.rvm/src/ruby-1.9.2-p180
ruby-1.9.2-p180 - #extracted to /Users/willdennis/.rvm/src/ruby-1.9.2-p180
Fetching yaml-0.1.3.tar.gz to /Users/willdennis/.rvm/archives

curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). The default
 bundle is named curl-ca-bundle.crt; you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
ERROR: There was an error, please check /Users/willdennis/.rvm/log/ruby-1.9.2-p180/*.log. Next we'll try to fetch via http.
Trying http:// URL instead.

curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). The default
 bundle is named curl-ca-bundle.crt; you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
ERROR: There was an error, please check /Users/willdennis/.rvm/log/ruby-1.9.2-p180/*.log
Extracting yaml-0.1.3.tar.gz to /Users/willdennis/.rvm/src
ERROR: Error running 'tar zxf /Users/willdennis/.rvm/archives/yaml-0.1.3.tar.gz -C /Users/willdennis/.rvm/src --no-same-owner', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/yaml/extract.log
/Users/willdennis/.rvm/scripts/functions/packages: line 55: cd: /Users/willdennis/.rvm/src/yaml-0.1.3: No such file or directory
Configuring yaml in /Users/willdennis/.rvm/src/yaml-0.1.3.
ERROR: Error running ' ./configure --prefix="/Users/willdennis/.rvm/usr"  ', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/yaml/configure.log
Compiling yaml in /Users/willdennis/.rvm/src/yaml-0.1.3.
ERROR: Error running '/usr/bin/make ', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/yaml/make.log
Installing yaml to /Users/willdennis/.rvm/usr
ERROR: Error running '/usr/bin/make install', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/yaml/make.install.log
ruby-1.9.2-p180 - #configuring 
ERROR: Error running ' ./configure --prefix=/Users/willdennis/.rvm/rubies/ruby-1.9.2-p180 --enable-shared --disable-install-doc --with-libyaml-dir=/Users/willdennis/.rvm/usr ', please read /Users/willdennis/.rvm/log/ruby-1.9.2-p180/configure.log
ERROR: There has been an error while running configure. Halting the installation.

How can I resolve or avoid this error?

沙发
+1250

如果在嘗試更新到1.9.3時遇到任何其他人(儘管版本可能無關緊要),請檢查您擁有的rvm版本。Wayne似乎從rvm.beginrescueend.com搬到了rvm.io. 舊網站的安全證書已過期,因此curl的響應是正確的。

從新網站更新rvm解決了這個問題並允許我繼續前進。

  $ curl  - L https://get.rvm.io | bash -s stable --rails --autolibs = enabled   

更新:正如@rodgerdpack所提到的,命令發生了變化,我已經更新了上面的內容。一般情況下,請參閱 https://rvm.io/ 了解最新信息。

我希望我先看到這個答案。即使使用上面提出的解決方案,在帶有RVM的Mac OS X上安裝1.9.3也無法正常工作。但是,更新RVM可以解決問題。 - chris_radcliff 12年11月11日19:53

這正是我在尋找的東西。非常感謝! - M.ElSaka 12年5月15日4:50

這對我來說也是如此(從1.9.2升級到1.9.3)感謝@jwadsa​​ck - Anna Billstrom 12月31日在16:12

這些天運行你提到的命令會給出一條消息,上面寫著“你正在運行一個破舊的ubuntu軟件包,請參閱stackoverflow.com/questions/9056008/以了解如何修復它” - rogerdpack 12年12月26日16:20

板凳
+400

如果不想更改腳本並且您不想將“永遠”的證書添加到證書包中。有一個非常好的快速解決方案:

 #下載cert wget http://curl.haxx.se/ca/cacert.pem#讓curl用它來進行下一次調用導出CURL_CA_BUNDLE =?/ cacert.pem   

然後運行您的腳本。要重置環境變量(對於不應使用此證書的後續腳本調用),請重新登錄系統或取消設置環境變量:

  export CURL_CA_BUNDLE =  
     
			
        

這解決了yaml的一個問題,但是我對複雜的其他部分有不同的問題。 - 艾默生2011年11月8日22:40

現在我可以在CentOS上安裝rvm。非常感謝你 - 2011年12月13日上午9點02分

在我的n810 - Rocky Jan 1月12日10:37對我有用

在OSX Lion w / rvm 1.8.3上什麼也沒做。 - 馬克里奇曼2012年4月21日15:54

適用於Centos5.4。謝謝。 - goofansu 2013年1月4日9:35

地板
+210

在.rvm / scripts / fetch中調用Curl,默認情況下會在您的主目錄中。

使用您喜歡的文本編輯器編輯它:例如,

 <代碼> nano~ / .rvm / scripts / fetch   

在第56和58行(當然可能與其他版本的RVM不同),你會看到兩行開始

  fetch_command =“curl ...   

只需在捲曲後添加-k,保存並重試。

為我工作,謝謝 - 2011年8月24日在1:24的deb

謝謝,這對我有用。 - amaseuk 2011年8月24日16:01

它對我不起作用,但我按照你的想法找到了這個替代方案:在你的主文件夾中創建一個“.curlrc”文件('〜/ .curlrc')。在任何編輯器中打開它,然後在文件中鍵入“insecure”。保存文件,希望最好。 - Julian Weimer 2011年9月6日17:46

RVM永遠不會包含這種變化,我們不鼓勵這樣做,如果你需要使用不安全(-k)只需調用echo insecure >>〜/ .curlrc,或者更好的只是更新每個@dbikard指令的證書 - mpapis Dec 10 '11在19:07

這很可能是因為下面帖子中提到的rvm.io的URL更改,並且是解決此問題的正確方法。您無需忽略SSL證書或捲曲行為。只需通過發出$ curl -L get.rvm.io |來從正確的URL更新rvm bash -s stable如下圖所示 - cclark 12年4月23日5:59

4楼
+200

您需要從 http://curl.haxx.se/ca/下載ca證書cacert.pem 並將它們添加到curl-ca-bundle-new.crt文件中。

要查找此文件的位置,請使用:

  $ curl-config --ca /usr/share/curl/curl-ca-bundle.crt   

備份你的curl-ca-bundle.crt文件:

 <代碼> $ cp /usr/share/curl/curl-ca-bundle.crt /usr/share/curl/curl-ca-bundle.crt.old   

然後你要連接這兩個文件使用:

  $ cat cacert.pem /usr/share/curl/curl-ca-bundle.crt>&gt; curl-ca-bundle-new.crt  
     
			
        

謝謝,你救了我一些時間! - Tadas Tamosauskas 2011年7月31日19:56

不適用於OSX Snow Leopard。 - Wasabi 12年4月4日17:04

這個(本來可以)在OpenIndiana 151上節省了我的時間。如果我可以不止一次地投票。 - 安德魯伯恩斯12月8日在20:50

這在CentOS 5.8上對我有用; Certs位於/ etc / pki / certs /中,適用於那些需要在CentOS上找到它的人! - geedew 2014年2月21日15:56

你用你的curl-ca-bundle-new.crt做了什麼? - Valerio Schiavoni於2014年8月12日8:14

5楼
+170

也許所有這些複雜的解決方案都是必要的,但現在您需要做的就是首先升級RVM並解決您的問題:

  $ rvm get stable $ rvm reload $ rvm install ruby-1.9.3-p194  
     
			
        

謝謝和+1快速解決方案 - ashisrai_ 12月3日在7:44

不幸的是,如果您的RVM版本足夠老,“rvm get head”甚至不起作用。@ jwadsa​​ck的答案解釋了原因。 - 亞歷克斯D 12年8月18日15:03

對,是真的。另外,回顧我的回答,“rvm get head”也不是最好的建議。它應該是“rvm穩定”。我要編輯我的答案以反映這一點。 - 尼克·梅西克2012年8月20日18:07

6楼
+140

如果您不介意在curl中禁用證書檢查(我沒有):

  echo insecure&gt; ?/ .curlrc  
     
			
        
7楼
+110

On Centos 5.6(最終版??)我遇到安裝rvm 1.9.2的問題錯誤是:

  curl:(60)SSL證書問題,驗證CA證書是否正常。詳細信息:錯誤:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:證書驗證失敗更多詳細信息:http://curl.haxx.se/docs/sslcerts.html curl默認使用證書頒發機構的“捆綁”執行SSL證書驗證( CA)公鑰(CA證書)。默認包名為curl-ca-bundle.crt; 您可以使用--cacert選項指定備用文件。如果此HTTPS服務器使用由捆綁包中表示的CA簽名的證書,則證書驗證可能由於證書問題而失敗(可能已過期,或者名稱可能與URL中的域名不匹配)。如果你' 要關閉curl對證書的驗證,請使用-k(或--insecure)選項。錯誤:出現錯誤,請查看/usr/local/rvm/log/ruby-1.9.2-p290/*.log。接下來我們將嘗試通過http獲取。嘗試使用http:// URL。curl:(60)SSL證書問題,驗證CA證書是否正常。詳細信息:錯誤:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:證書驗證失敗更多詳細信息:http://curl.haxx.se/docs/sslcerts.html curl默認使用證書頒發機構的“捆綁”執行SSL證書驗證( CA)公鑰(CA證書)。默認包名為curl-ca-bundle.crt; 您可以使用--cacert選項指定備用文件。如果此HTTPS服務器使用由捆綁包中表示的CA簽名的證書,證書驗證可能由於證書問題而失敗(可能已過期,或者名稱可能與URL中的域名不匹配)。如果您要關閉curl對證書的驗證,請使用-k(或--insecure)選項。錯誤:出現錯誤,請檢查/usr/local/rvm/log/ruby-1.9.2-p290/*.log錯誤:嘗試獲取源時出錯。暫停安裝。錯誤:獲取ruby解釋器時出錯。暫停安裝。  

以下是幫助我解決問題的操作列表

  $ curl-config --ca#show path of certificate / usr / local / share / curl / curl-ca-bundle.crt $ cd / usr / local / share / curl /#轉到該路徑$ cp curl-ca-bundle.crt curl-ca-bundle.crt。
     
			
        

很好的解決方案,在我的情況下,我執行“rvm get head”時遇到此錯誤。在linux中小心使用文件curl-ca-bundle.crt的名稱!與眾不同 - AlbertCatalà13年12月12日10:49

8楼
+30

我試圖安裝 ruby??-1.9.2-p290 並遇到同樣的問題。運行 curl 並意識到curl實例來自我的系統(OS X Snow Leopard)上的MAMP安裝後,我重新配置了我的 PATH 變量來使用系統默認為 / usr / bin / curl 使用這個版本, curl 7.19.7 ,我在使用RVM安裝最新版本的Ruby時沒有任何問題。

9楼
+20

我在使用RVM安裝1.9.2時遇到問題,這是我的解決方案:

  • http://www.filewatcher.com/m/yaml-0.1.3.tar.gz。 466845.0.0.html
  • 將其保存到/ Users //。rvm / archives / yaml-0.1.3.tar.gz
  • 運行這些命令:

    chmod 777 yaml-0.1.3.tar.gz

    tar zxf /Users//.rvm/archives/yaml-0.1.3.tar.gz -C / Users //。rvm / src

    我仍然找不到文件錯誤但安裝繼續成功

    [2011- 07-05 14:24:07] tar zxf /Users//.rvm/archives/yaml-0.1.3.tar.gz -C / Users //。rvm / src --no-same-owner tar(child):/Users//.rvm/archives/yaml-0.1.3.tar.gz:無法打開:沒有這樣的文件或目錄tar(子):錯誤不是可恢復:現在退出tar:子返回狀態2 tar:從先前錯誤延遲的錯誤退出

我做了類似的事情並且做得很好:wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz; cp yaml-0.1.4.tar.gz /Users/yourname/.rvm/archives; rvm安裝默認 - 2011年12月27日15:02

只有這個解決方案適用於Mac Osx Lion。非常感謝! - Christian Treppo於12年7月7日在1:43

驚人的單行,thx Wei - flunder 2013年2月13日11:13

10楼
+10
更改安全性,以便每個人都擁有所有權/所有權限,並關閉所有文件和文件夾的只讀屬性。

安裝程序在嘗試下載時仍會拋出錯誤(CURL錯誤),但會通過嘗試提取而恢復。提取會拋出錯誤,因為tarball已經被解壓縮到src文件夾中。如果正確設置了步驟3中的權限並且安裝應該完成而沒有其他問題,則配置YAML的下一步應該沒有錯誤。(如果通過cygwin / bash安裝,則需要添加一個C編譯器,如'gcc',並將'ncurses'(tput命令)和'make'添加到默認的核心cygwin設置選項中。) p>安裝程序在嘗試下載時仍會拋出錯誤(CURL錯誤),但會通過嘗試解壓縮而恢復。提取會拋出錯誤,因為tarball已經被解壓縮到src文件夾中。如果正確設置了步驟3中的權限並且安裝應該完成而沒有其他問題,則配置YAML的下一步應該沒有錯誤。(如果通過cygwin / bash安裝,則需要添加一個C編譯器,如'gcc',並將'ncurses'(tput命令)和'make'添加到默認的核心cygwin設置選項中。) p>安裝程序在嘗試下載時仍會拋出錯誤(CURL錯誤),但會通過嘗試解壓縮而恢復。提取會拋出錯誤,因為tarball已經被解壓縮到src文件夾中。如果正確設置了步驟3中的權限並且安裝應該完成而沒有其他問題,則配置YAML的下一步應該沒有錯誤。(如果通過cygwin / bash安裝,則需要添加一個C編譯器,如'gcc',並將'ncurses'(tput命令)和'make'添加到默認的核心cygwin設置選項中。) 如果正確設置了步驟3中的權限並且安裝應該完成而沒有其他問題,則配置YAML的下一步應該沒有錯誤。(如果通過cygwin / bash安裝,則需要添加一個C編譯器,如'gcc',並將'ncurses'(tput命令)和'make'添加到默認的核心cygwin設置選項中。) 如果正確設置了步驟3中的權限並且安裝應該完成而沒有其他問題,則配置YAML的下一步應該沒有錯誤。(如果通過cygwin / bash安裝,則需要添加一個C編譯器,如'gcc',並將'ncurses'(tput命令)和'make'添加到默認的核心cygwin設置選項中。)

11楼
0
  $ sudo apt-get install curl $ curl -L https://get.rvm.io | bash -s stable --ruby with ruby?? $ curl -L https://get.rvm.io | bash -s stable  - 帶軌道的欄目 
     
			
        
7
votes
answers
70 views
+10

Foreman rvm upstart not work

Unicorn not runs by upstart script.

rvm 1.25.23 ruby 2.1.1 Rails 4.1

config/deploy.rb

  desc 'Foreman init'
  task :foreman_init do
    on roles(:all) do
      foreman_temp = "/home/deployer/tmp/foreman"
      execute  "mkdir -p #{foreman_temp}"
      execute "ln -s #{release_path} #{current_path}"
      within current_path do
        execute "cd #{current_path}"
        execute :bundle, "exec foreman export upstart #{foreman_temp} -a #{application} -u deployer -l /home/deployer/apps/#{application}/log -d #{current_path}"
      end
      sudo "mv #{foreman_temp}/* /etc/init/"
      sudo "rm -r #{foreman_temp}"
    end
  end

/etc/init/depl-web-1.conf

start on starting depl-web
stop on stopping depl-web
respawn

env PORT=5000

setuid deployer

chdir /home/deployer/apps/depl/current

exec bundle exec unicorn_rails -c /home/deployer/apps/depl/current/config/unicorn.rb -E production

/log/upstart/depl-web-1.log and production.log clear

if you go to the application's directory and manually run the command

bundle exec unicorn_rails -c /home/deployer/apps/depl/current/config/unicorn.rb -E production

Unicorn successfully launched.

If in /etc/init/depl-web-1.conf exec line add port

exec bundle exec unicorn_rails -p $PORT -c

/home/deployer/apps/depl/current/config/unicorn.rb -E production

error:

/bin/sh: 1: exec: bundle: not found

i use rvm

which bundle
/home/deployer/.rvm/gems/ruby-2.1.1/bin/bundle
which rvm
/home/deployer/.rvm/bin/rvm
+40

I ended up doing something similar to Denis, except used Ruby wrapper per RVM docs. This was really really annoying tbh, but according to top -c and shift-M it's working. Written semi-verbose because I hope this helps someone else.

My setup is: Digital Ocean, Ubuntu 14.10, Rails 4.0.x, Ruby 2.0.x, RVM 1.26.10. My Procfile is only for background jobs since I'm using Passenger 5+Nginx. The deploying user is 'rails'. I have a gemset called "ruby-2.0.0-p598@rockin" for my app called "rockin" since I run multiple apps on the box.

Adding in the absolute PATH to bundle did NOT work for me.

Here's what I did:

  1. Create rvm wrapper per docs. (user is rails)

    rvm alias create rockin ruby-2.0.0-p598@rockin
    
  2. Create .env file for RAILS_ENV and PATH for bundle

    RAILS_ENV=production 
    
  3. Attempt to foreman export to upstart

    rvmsudo foreman export upstart /etc/init -a rockin -u rails
    
  4. Decided to tail the logs because of the bundle issue in another window as sanity check. (user is root)

    tail -f /var/log/upstart/rockin-worker-1.log
    
  5. Change the upstart file manually. The file I needed to edit was rockin-worker-1.conf. Since most of the thing was pretty formatted and had what I needed, I changed the exec lines to truly point to bundle using the wrapper created above.

    start on starting rockin-worker
    stop on stopping rockin-worker
    respawn
    
    env PORT=5000
    env RAILS_ENV='production'
    
    setuid rails
    
    chdir /home/rails/rockin
    
    exec /usr/local/rvm/wrappers/rockin/bundle exec rake environment resque:work QUEUE=*
    
  6. Run it!

    sudo start rockin-worker 
    
  7. You can check with the tailed logs, but if you see no output, you're good to go! Then double-check top by doing top -c and shift-M. My resque worker started up and went into waiting mode. PERFECT.

This should work for anyone using rvm and other background workers like sidekiq.

To anyone saying PATH would have worked, I tried both which bundle and whereis bundle from the root dir of my app and using those paths for the .env file. Neither worked and both resulted in the logs complaining about /bin/sh: 1: exec: bundle: not found.

板凳
+20
+50

I manually edited.

start on starting depl-web
stop on stopping depl-web
respawn

env PORT=5000
env RVM_SHELL=/home/deployer/.rvm/bin/rvm-shell
env RUBY_VERSION="2.1.5"
setuid deployer
script
chdir /home/deployer/apps/depl/current
$RVM_SHELL $RUBY_VERSION -c 'bundle exec unicorn_rails -c /home/deployer/apps/depl/current/config/unicorn.rb -E production'
end script
+10

Foreman changed the upstart template file used when exporting.

The reason for the change was to clean up the file using upstart native features and to be more secure by not exposing environment variables on ps.

Relevant pull request on GitHub: #438

Relevant issue on GitHub: #443

There are several ways to deal with the change, but it seems that adding the path to bundle to PATH in the .env file should work.

0

I added this to my deployment script and it seems to be working. I don't know if it's a good solution or not, but it was quick.

execute 'cat /etc/environment > /var/www/my-app/continuous-integration/current/.env'
0

This can work without manual editing of the upstart files...

I have bundler install binstubs, and then have my Procfile set up like this:

workers: /bin/bash -l -c "./bin/bundle exec sidekiq"

It works with no manual editing.

0

What worked for me was almost like solution given by @Denis. Few things that were different were using rvm bin instead of rvm-shell and ruby version along with gems instead of only ruby version. so my final cons file was like:

start on starting depl-web
stop on stopping depl-web
respawn

env PORT=5000
env RVM_SHELL=/usr/local/rvm/bin/rvm
env RUBY_VERSION="ruby_version@gemset_name"
setuid deploy
script
chdir /var/www/depl/current
$RVM_SHELL $RUBY_VERSION do bundle exec puma -C /var/www/depl/current/config/puma.rb
end script
813
votes
answers
55 views
+10

How to Uninstall RVM? [duplicate]

Possible Duplicate:
How to remove rvm (ruby version manager) from my system?

How can I uninstall (or reinstall) RVM on Ubuntu 9.10? I messed up my current installation.

up vote 813 down vote accepted favorite
沙发
+8130
+50

It’s easy; just do the following:

rvm implode

or

rm -rf ~/.rvm

And don’t forget to remove the script calls in the following files:

  • ~/.bashrc
  • ~/.bash_profile
  • ~/.profile

And maybe others depending on whatever shell you’re using.

你需要這樣做:rvm implode --force - jesse cai 6月26日在6:41

0
votes
answers
74 views
+10

RVM的鬼魂糾纏着我

0

我最近安裝了Ruby版本管理器(RVM),並再次卸載它,使用這個「焦土」腳本:RVM的鬼魂糾纏着我

#!/bin/bash 
/usr/bin/sudo rm -rf $HOME/.rvm $HOME/.rvmrc /etc/rvmrc 
/etc/profile.d/rvm.sh /usr/local/rvm /usr/local/bin/rvm 
/usr/bin/sudo /usr/sbin/groupdel rvm 
/bin/echo "RVM is removed. Please check all .bashrc|.bash_profile|.profile|.zshrc for RVM source lines and delete or comment out if this was a Per-User installation."` 

(我發現這個劇本here我也嘗試過更膽小方法如rvm imploderm -rf ~/.rvm等)

現在

$ which rvm

個回報什麼,但RVM似乎仍然存在以某種形式,因爲當我輸入

$ rvm implode

我得到的反應,具體爲:

cat: /Users/lolan/.rvm/VERSION: No such file or directory Warning! PATH is not properly set up, '/Users/lolan/.rvm/gems/ruby-2.3.1/bin' is not available. Usually this is caused by shell initialization files. Search for 'PATH=...' entries. You can also re-add RVM to your profile by running: 'rvm get stable --auto-dotfiles'. To fix it temporarily in this shell session run: 'rvm use ruby-2.3.1'. To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file. -bash: /Users/lolan/.rvm/scripts/base: No such file or directory -bash: /Users/lolan/.rvm/scripts/functions/implode: No such file or directory Are you SURE you wish for rvm to implode? This will recursively remove /Users/lolan/.rvm and other rvm traces? (anything other than 'yes' will cancel) > Psychologist intervened, cancelling implosion, crisis avoided :)

(這時候我輸入的回報當它提示我'是'時。其他時間,我輸入'是'。)

基本上,我很迷惑$ which rvm如何返回什麼,但$ rvm implode不返回「找不到命令」。這與我認爲我對命令行的理解是相反的......

無論如何,我怎麼才能真的殺死RVM,連同它的心理學家和所有? :)

PS:我在macOS 10.12上。

==============

更新:看來,儘管已通過所有標準步驟後去除RVM(見上文),儘管刷新殼(點菜source .bash_profile,source .bashrc,source .profile),外殼仍然留着一些內存,不知何故,RVM,當我開始一個全新的外殼時就消失了。

我仍然想更好地理解shell是如何保持周圍的,因爲保留腳本文件夾的各個部分(在刪除腳本文件夾之後!?!?)對我來說似乎是危險的,違反直覺的。

沙发
0
0

這是因爲rvm位於您的主目錄的隱藏目錄中,而不是您的PATHwhich使用與bash相同的算法在環境變量PATH中列出的目錄中搜索可執行文件或腳本。如果它沒有找到它,那麼它將不會被退回。如果你想知道如何刪除RVM there is already an answer for that。最簡單的方法是:rm -rf ~/.rvm

+0

正如我的問題所述,我已經做了'rm -rf?/ .rvm'。您指出的鏈接也已經在我的問題中引用。無論如何,我只是再次檢查一下'rm?/ .rvm'不會改變結果。下次請仔細閱讀該問題。 – Labrador

+0

順便說一句,如果'?/ .abc'是一個隱藏文件夾,在命令行輸入'abc xyz'會發送shell在?/ .abc目錄下尋找腳本「xyz」somwhere?即使?/ .rvm文件夾仍然存在(它不是),我不明白「rvm」將被視爲可執行命令的機制......你能解釋一下嗎? – Labrador

+1

檢查[二進制與功能模式](https://rvm.io/workflow/scripting)。rvm作爲shell函數加載。 – anothermh

0
votes
answers
60 views
+10

RVM: List all gems in current gemset ignoring global & default

Looking for something like gem list within an RVM gemset but to have it ignore gems in the global and default gemsets so I can see, easily, exactly what gems are in the active gemset (and only the active gemset).

60
votes
answers
54 views
+10

how to make a gemset in RVM the default?

I'm trying to make a gemset the default whenever I start a new terminal in Mac OS X:

rvm use 1.9.3@rails3.2 --create --default

That seems to work, the rails3.2 gemset becomes the current gemset:

$ rvm gemset list

gemsets for ruby-1.9.3-p0 (found in /Users/me/.rvm/gems/ruby-1.9.3-p0)
   global
=> rails3.2

$

But when I open up a new terminal, the rails3.2 gemset is no longer the current:

$ rvm gemset list

gemsets for ruby-1.9.3-p0 (found in /Users/me/.rvm/gems/ruby-1.9.3-p0)
   global
   rails3.2

$

What do I do?

up vote 48 down vote accepted favorite
沙发
+480
+50

您是否rvm --default use在創建gemset後嘗試指定,因此傳遞:

 rvm --default use ruby-1.9.3-p0@rails3.2

然後看看是否粘?同時使用create和default不是我以前嘗試過的東西,它是唯一讓我覺得不合適的東西。

鑑於下面的討論,我將此作為處理問題的手段。(就我個人而言,我可能會破壞rvm並重新開始。) 但是,如果您想嘗試使用此安裝進行操作,那麼我會查看您的.rvm文件夾,特別是.rvm/environments/default 其中包含導出的所有環境變量默認環境。在這裡,您會發現rvm_gemset_name這可能設置不正確,並且由於某種原因(權限?)沒有更新,或者在這種情況下正確設置了其他一些環境問題。如果不正確,您可以嘗試在文件中手動設置它。

同樣的問題......我運行它並且rvm gemset列表看起來不錯。但後來我打開了一個新的終端選項卡,rails3.2 gemset不再是當前的。- 在。12月14日在18:59

順便說一句,我使用的是ruby-1.9.3-p0@rails3.2,也只是1.9.3@rails3.2,它們的行為都相同 - 在。12月14日'12在19:00

什麼是你的.rvmrc和.profile的rvm? - Mike K. 12月14日在19:01

.rvmrc只包含一個rvm_path環境變量,我沒有.profile - at。12月15日'12在4:56

我用其他一些東西來修改我的答案。希望這可以幫助。 - Mike K. 12月15日在5:13

+60

使用以下命令將gemset設為默認值。

rvm use <ruby version>@<gemset name> --default

例如。

 rvm use 1.8.7-p370@mygemset --default
+60

您可以使用此命令。

rvm use --default <ruby version>@<gemset name>

要么

rvm --default use <ruby version>@<gemset name> 要么

rvm use <ruby version>@<gemset name> --default 

第一個命令對我有用。謝謝。 - cheshireoctopus 2014年4月10日4:13

@cheshireoctopus你是受歡迎的人 - Amrit Dhungana 2014年4月10日4:44

0

有趣的是,沒有人提到rvm別名。嘗試針對特定版本的版本,對我有用:

$ rvm alias create default ruby-2.3.0@rails_4_2_6
# me logs out, fetches another coffee
# me logs in
$ rvm list

rvm rubies

   ruby-2.2.4 [ x86_64 ]
=* ruby-2.3.0 [ x86_64 ]

$ rvm gemset list

gemsets for ruby-2.3.0 (found in /home/aclarke/.rvm/gems/ruby-2.3.0)
   (default)
   global
=> rails_4_2_6
0

rubyracer相關問題也可能來自libv8。要解決此問題:步驟1:運行以下命令以卸載libv8的任何現有安裝:

gem uninstall libv8

運行以下命令安裝rubyracer:

gem install therubyracer -v 0.12.2

通過運行以下命令安裝libv8:

gem install libv8 -v 3.16.14.15 -- --with-system-v8

立即嘗試捆綁安裝:

bundle install
0

您可以使用此命令

$ rvm use rubyversion@gemsetname --create --ruby-version

例如:ruby version = ruby??-2.1.2

gemset name = gem320

這將是

$ rvm use ruby-2.1.2@gem320 --create --ruby-version.

即使您也打開其他選項卡,它也會保留設置。

我做了rvm使用ruby-2.2.3@rails426 --create --ruby-version但是當我打開其他標籤時它仍然沒有保留設置,我得到一個錯誤,說你的Ruby版本是2.2.1,但你的Gemfile指定2.2.3 - vipin8169 2016年3月8日11:04