rvm install ruby-1.9.2 error

Posted

今天要跑一个老的代码。发现rvm 装不了ruby1.9.2啦,报了错。

还以为是rvm 的问题... 升级了rvm.还是一样的。

想到之前Mac osX 升到了Mavericks。XCODE中的"command line tools"不见了。

$ rvm install ruby-1.9.2
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.9/x86_64/ruby-1.9.2-p320.
It is not possible to build movable binaries for rubies 1.8-1.9.2, but you can do it for your system only.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' already are up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/xxxx/.rvm/rubies/ruby-1.9.2-p320, this may take a while depending on your cpu(s)...
ruby-1.9.2-p320 - #downloading ruby-1.9.2-p320, this may take a while depending on your connection...
ruby-1.9.2-p320 - #extracting ruby-1.9.2-p320 to /Users/xxxx/.rvm/src/ruby-1.9.2-p320.
ruby-1.9.2-p320 - #configuring.
Error running 'env CFLAGS=-O3 -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include LDFLAGS=-L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib ./configure --prefix=/Users/xxxx/.rvm/rubies/ruby-1.9.2-p320 --with-opt-dir=/usr/local/opt/libyaml --without-tcl --without-tk --enable-shared',
showing last 15 lines of /Users/xxxx/.rvm/log/1388926523_ruby-1.9.2-p320/configure.log
[2014-01-05 20:55:27] ./configure
current path: /Users/xxxx/.rvm/src/ruby-1.9.2-p320
GEM_HOME=/Users/xxxx/.rvm/gems/ruby-2.0.0-p353
PATH=/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/xxxx/.rvm/gems/ruby-2.0.0-p353/bin:/Users/xxxx/.rvm/gems/ruby-2.0.0-p353@global/bin:/Users/xxxx/.rvm/rubies/ruby-2.0.0-p353/bin:/Users/xxxx/.rvm/bin:/Users/xxxx/eclipse/sdk/platform-tools:/Users/xxxx/mydata/bin:/usr/local/coreseek/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
GEM_PATH=/Users/xxxx/.rvm/gems/ruby-2.0.0-p353:/Users/xxxx/.rvm/gems/ruby-2.0.0-p353@global
command(9): env CFLAGS=-O3 -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include LDFLAGS=-L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib ./configure --prefix=/Users/xxxx/.rvm/rubies/ruby-1.9.2-p320 --with-opt-dir=/usr/local/opt/libyaml --without-tcl --without-tk --enable-shared
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... i386-apple-darwin13.0.0
checking host system type... i386-apple-darwin13.0.0
checking target system type... i386-apple-darwin13.0.0
checking whether the C compiler works... no
configure: error: in `/Users/xxxx/.rvm/src/ruby-1.9.2-p320':
configure: error: C compiler cannot create executables
See `config.log' for more details
There has been an error while running configure. Halting the installation.

引用品评 OS X Mavericks ——唯快不破(中)

发生编译错误是因为 Xcode 的 command line tools 没装,在 OS X 里玩命令行没有这货是万万不行的。这时你微笑着打开 Xcode,找到Preferences—Downloads—Components,发现,command line tools 的安装包不见袅!再一次,Mavericks 把 XCode 4.6.3的 command line tools 全部干掉了,而且你还找不到单独的10.9的 command line tools 安装包,当你想装10.8 的包时,系统会明确的告诉你版本不合适,想都别想。 在诅咒了这个万恶的强删制度以后,我决定使出杀手锏和 Plan B,在命令行输入xcode-select --install,这时会弹出一个选项框,问你是去下载 Xcode 还是直接安装,选择安装,你会发现,总会有解决方案的。

以上写这么多就是一句话搞定,呵呵!

xcode-select --install

ref:


此文章 短链接: http://dlj.bz/JXoEkN