前段时间在玩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. 比较详细PHP生成静态页面教程

    一,PHP脚本与动态页面. PHP脚本是一种服务器端脚本程序,可通过嵌入等方法与HTML文件混合, 也可以类,函数封装等形式,以模板的方式对用户请求进行处理.无论以何种方式,它的基本原理是这样的.由客 ...

  2. ViewPager + Fragment实现滑动标签页

    http://blog.csdn.net/lizhenmingdirk/article/details/13631813; tab与frg的区别: http://www.cnblogs.com/tia ...

  3. sqlserver巧用row_number和partition by分组取top数据

    SELECT * FROM( SELECT orderid,createtime, ROW_NUMBER() over(PARTITION by orderid order by createtime ...

  4. web.py+mysql插入中文提示query = query.encode(charset) UnicodeEncodeError: 'latin-1' codec can't encode characters in position 86-100

    对于中文编码的问题,总会出现各种各样恶心的错误,还不知道应该怎么解决,首先,你从最开头就应该关注编码问题,尽量保证所有的编码方式都是一致的 用python+web.py+mysql来写程序,首先要保证 ...

  5. 简单的python服务器程序

    一个接受telnet输入的服务器端小程序 #!/usr/local/bin/python3.5 #coding:utf-8 import socket host = '' port = 51423 s ...

  6. PHP安装rrdtool扩展

    首先,我的环境是Centos 6.5 PHP版本是5.51.首先安装rrdtool需要的依赖库文件   yum -y install pango* 2.先服务器安装rrdtool  wget http ...

  7. win32api 获取文件版本信息

    #coding:utf-8 myPath="C:\\ime" import os from win32api import GetFileVersionInfo, LOWORD, ...

  8. 云计算和大数据时代网络技术揭秘(八)数据中心存储FCoE

    数据中心存储演化——FCoE   数据中心三大基础:主机 网络 存储 在云计算推动下,存储基础架构在发生演变 传统存储结构DAS.SAN在发展中遇到了布线复杂.能耗增多的缺点(原生性),需要对架构做根 ...

  9. 【半平面交】bzoj1038 [ZJOI2008]瞭望塔

    http://m.blog.csdn.net/blog/qpswwww/44105605 #include<cstdio> #include<cmath> #include&l ...

  10. Hibernate配置文件与映射文件的创建

    1. config文件的创建: 内容: <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE hib ...