Mac系统安装Rails

最近有门课要写一个简单的Web应用,以前写Web都是用Java写的,由于以前搞Cloud Foundry开发的时候用过一段时间的Ruby,想想这次还是用Ruby On Rails写算了,能节省很多时间。由于Ruby电脑上已经有了,所以直接安装Rails就可以了。

sudo gem install rails

额,但是很快就报错了。。。

Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://api.rubygems.org

貌似因为被墙的原因,好像下载失败。虽然翻墙也容易,但是我想还是介绍一下不翻墙的解决办法吧。主要就是修改gem的源,由于墙的原因,rails官方的源似乎无法访问,那么只能改成taobao的源了。输入以下命令:

gem sources -l
gem sources --remove https://rubygems.org/
gem sources -a https://ruby.taobao.org/
gem sources -l

其中gem sources -l是显示源列表,这里先将官方的源删除再添加taobao的源,如果最后结果如下,说明添加成功:

*** CURRENT SOURCES ***

https://ruby.taobao.org/

接下来再安装rails还是失败。。。

Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    /Users/nmacaule/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150209-56320-1m9byas.rb extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
-----

The file "/usr/include/iconv.h" is missing in your build environment,
which means you haven't installed Xcode Command Line Tools properly.

To install Command Line Tools, try running `xcode-select --install` on
terminal and follow the instructions.  If it fails, open Xcode.app,
select from the menu "Xcode" - "Open Developer Tool" - "More Developer
Tools" to open the developer site, download the installer for your OS
version and run it.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-op
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值