因为想要在osx中安装gitlab,而gitlab是ruby写的,在安装rails和gem的过程中碰到了一些问题:
关于gem的管理:
gem sources -l
如果你使用https://rubygems.org 会有问题,因为被GFW了,所以你可以使用淘宝的gem server:
sudo gem sources -a https://ruby.taobao.org
如果你之前有https://rubygems.org的sources,那么先删除:
sudo gem sources –remove https://rubygems.org
之后就可以安装rails了:
sudo gem install rails
可能你会碰到这个错误:
SSL Error When installing rubygems, Unable to pull data from ‘https://rubygems.org/
这是gem 2.0.*版本的bug(参考:http://stackoverflow.com/questions/19150017/ssl-error-when-installing-rubygems-unable-to-pull-data-from-https-rubygems-o/),所以你可以这样来解决:
gem update –system
然后继续安装的时候会出现文档的报错:unable to convert “\x89” from ASCII-8BIT
那么是因为doc的问题(参考:http://stackoverflow.com/questions/18235293/ruby-on-rails-unable-to-convert-x89-from-ascii-8bit-to-utf-8-for-xxx-xxxx-x),你可以:
sudo gem install rdoc
然后:
sudo gem –all –overwrite
to regenerate the documentation.
关于gem sources的管理:
gem sources -a https://ruby.taobao.org
gem sources -r http://rubygems.org