前段时间在玩Chef-一个IT基础设施自动化工具。由于Chef是由Ruby写的一个gem,那么就需要安装Ruby。当然Ruby我早就安装了,并且使用rvm来管理Ruby及Gem。本来一切看似正常,但是不会预料后面会遇到那么多的坑。

Chef本地的repo包中有一个vagrant虚拟机的模板文件,通过它可以setup一个虚拟机,然后使用Chef来操作这个节点。那么就使用vagrant命令来setup这个虚拟机把。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ vagrant up --no-color
Vagrant failed to initialize at a very early stage: It appears that you've ran a newer version of Vagrant on this
computer. Unfortunately, newer versions of Vagrant change internal
directory layouts that cause older versions to break. This version
of Vagrant cannot properly run. If you'd like to start from a clean state, please remove the
Vagrant state directory: /Users/twer/.vagrant.d Warning that this will remove all your boxes and potentially corrupt
existing Vagrant environments that were running based on the future
version.

console中说Vagrant版本有问题,那么就按说明删除.vagrant.d文件夹把。

1
2
3
4
5
6
$ rm -rf ~/.vagrant.d/
$ vagrant up --no-color
/Users/twer/sourcecode/chef-repo/Vagrantfile:8:in `<top (required)>': undefined method `configure' for Vagrant:Module (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/vagrant-1.0.7/lib/vagrant/config/loader.rb:115:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/vagrant-1.0.7/lib/vagrant/config/loader.rb:115:in `block in procs_for_source'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/vagrant-1.0.7/lib/vagrant/config.rb:41:in `block in capture_configures'

窝里个去,又出新问题了。那好吧,看看当前ruby的版本。

1
2
3
4
5
6
7
8
9
10
$ rvm list

rvm rubies

   ruby-1.9.2-p320 [ x86_64 ]
=* ruby-1.9.3-p194 [ x86_64 ] # => - current
# =* - current && default
# * - default

试着将Ruby的版本切换到1.9.2-p320再试试。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ rvm use ruby-1.9.2-p320
Using /usr/local/rvm/gems/ruby-1.9.2-p320
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Setting hostname...
[default] Mounting shared folders...
[default] -- /vagrant

搞定。看来问题是当前使用的ruby的版本有问题。

老是使用旧版本也不是个事,把Ruby升级到最新版本看还有这个问题不。

1
2
3
4
5
6
7
8
9
10
11
$ rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-p374]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p320]
[ruby-]1.9.3[-p448]
[ruby-]2.0.0-p195
[ruby-]2.0.0[-p247]
[ruby-]2.0.0-head
ruby-head

看来ruby的1.9.3已经有p448了,那么就升级到p448。

1
2
3
4
5
6
7
8
$ rvm install 1.9.3
Checking requirements for osx.
Installing requirements for osx.
Updating system.
Installing required packages: libksba, openssl..........
Error running 'requirements_osx_brew_libs_install gcc libksba openssl',
please read /usr/local/rvm/log/1379843991_ruby-1.9.3-p448/package_install_gcc_libksba_openssl.log
Requirements installation failed with status: 1.

升级失败,那么看看log。

1
2
3
4
5
6
7
8
9
10
11
12
==> make bootstrap
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[1]: *** [stage1-bubble] Error 2
make: *** [bootstrap] Error 2 READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting There were package installation errors, make sure to read the log. Try `brew tap --repair` and make sure `brew doctor` looks reasonable.

通过看log是gcc编译失败,并且通过log可以看出rvm是通过homebrew来安装必备文件的。

通过一番查资料后,找到了解决办法。那就是将Xcode升级到最新版本,然后在Preference里选择Downloads标签,然后安装Command Line Tools。

安装完毕后再用Homebrew安装gcc49。

1
2
3
4
5
6
7
8
9
10
11
12
$ brew install gcc49
==> Downloading ftp://gcc.gnu.org/pub/gcc/snapshots/4.9-20130915/gcc-4.9-20130915.tar.bz2
Already downloaded: /Library/Caches/Homebrew/gcc49-4.9-20130915.tar.bz2
==> ../configure --build=x86_64-apple-darwin12.5.0 --prefix=/usr/local/Cellar/gcc49/4.9-20130915/gcc
==> make bootstrap
==> make install
==> Caveats
This is a snapshot of GCC trunk, which is in active development and
supposed to have bugs and should not be used in production
environment.
==> Summary

升级ruby版本那"不堪回首的经历"的更多相关文章

  1. 【转】如何在Mac 终端升级ruby版本

    原文网址:https://segmentfault.com/a/1190000003784636 rvm是什么?为什么要安装rvm呢,因为rvm可以让你拥有多个版本的Ruby,并且可以在多个版本之间自 ...

  2. Ruby学习笔记之升级ruby的版本

    升级ruby版本,有时候安装ruby的版本过低,需要进行升级,例如安装在centos6.7安装fpm需要ruby版本在1.9以上. 0x00 主机环境如下 [root@test ~]# cat /et ...

  3. 升级ruby的版本

    升级ruby版本,有时候安装ruby的版本过低,需要进行升级,例如安装在centos6.7安装fpm需要ruby版本在1.9以上. 1.主机环境如下: [root@test ~]# cat /etc/ ...

  4. 升级ruby的版本 https://gems.ruby-china.com/

    升级ruby版本,有时候安装ruby的版本过低,需要进行升级,例如安装在centos6.7安装fpm需要ruby版本在1.9以上. 1.主机环境如下: 1 [root@test ~]# cat /et ...

  5. 升级ruby后再安装cocodPod

    1.移除现有的Ruby $gem sources --remove https://rubygems.org/ 2.使用淘宝镜像 $gem sources -a https://ruby.taobao ...

  6. mac下升级ruby环境版本

    在ios开发中会经常使用到cocoapods来管理第三方框架,在安装cocoapods的时候会涉及到ruby环境,有时候会因为版本过低会导致安装失败,本文主要讲一下如何升级ruby环境 安装rvm,r ...

  7. 关于IOS新手在安装cocoa pods失败,因为ruby版本过低的解决方法+ (void) {升级ruby}

    http://blog.csdn.net/zhaoen95/article/details/51995520     现在: 使用 OS 系统, 正在学习iOS 需要配置cocoapods 命令行中显 ...

  8. macOS Ruby版本需要升级到2.2.2以上

    在安装 Ruby on Rails 时遇到问题,提示依赖 ruby 2.2.2 或更高的版本. ERROR: Error installing rails: activesupport require ...

  9. Mac下升级ruby至最新版本

    Mac自身的ruby 版本 2.x,通过ruby -v可以查看版本号. 为更新到ruby的最新版本,可通过以下命令解决: brew update brew install ruby 执行完命令后,ru ...

随机推荐

  1. SSO(单点登录)

    自己动手写SSO(单点登录) 标签: sso 登录 | 发表时间:2014-03-02 15:01 | 作者: 分享到: 出处:http://www.iteye.com SSO在我们的应用中非常常见, ...

  2. Brn系列商城4.1正式发布,欢迎大家下载体验

    此次升级内容如下: 独立IP搜索策略 独立文件上传策略 添加退换货功能 重构支付方式 常规性修复和改进 下载地址:http://www.brnshop.com

  3. Jquery DOM 操作列表

    jQuery 文档操作方法 这些方法对于 XML 文档和 HTML 文档均是适用的,除了:html(). jQuery 属性操作方法 下面列出的这些方法获得或设置元素的 DOM 属性. 这些方法对于 ...

  4. Java NIO教程 前言

    阅读本文前,建议你先了解 旧I/O NIO 是 New I/O 的缩写,要了解它真正的内涵,需要掌握的知识还是比较多的.我努力在这几篇笔记里,勾勒出整个io的面貌.为大家的深入学习铺路. I/O简史 ...

  5. mysql 数据库导入 导出,解决 导入 错误问题

    mysqldump -uxxxx -pxxxx -hrds2383jse53pi6ipwmf.mysql.rds.aliyuncs.com legaokao > /root/legaokaodu ...

  6. 在Linux下安装配置phpMyAdmin步骤

    本文于CentOS 6.5下测试可行,欢迎转载和指正. phpMyAdmin是一种基于Web的免费MySQL管理工具.phpMyAdmin是用PHP编写的,因此只有支持PHP的服务器才能使用phpMy ...

  7. iOS.StaticLibrary.1-avoid-duplicate-symbol-in-static-library[draft]

    Avoid duplicate symbol in static library and its customer 发布static library给使用者使用.在实际的工程实践中,iOS静态库一般会 ...

  8. 烧写AT91Bootstrap不能连接SAM-BA的解决方法

    AT91与SAM-BA的连接是由于芯片内有一段固化的代码运行起来后才会检测到目标板并建立连接.    假设现在你烧写了Bootstrap进去,芯片上电后发现有可运行的代码,从而就不执行片内固化的那个代 ...

  9. net 连mysql奇怪问题

    程序出现以上提示,采用6.3.5的connetor就好了.

  10. php使用openssl来实现RSA(非对称加密)

    使用非对称加密主要是借助openssl的公钥和私钥,用公钥加密私钥解密,或者私钥加密公钥解密. 1.安装openssl和PHP的openssl扩展 2.生成私钥:openssl genrsa 用于生成 ...