【CocoaPods】配置CocoaPods前 - 本地安装好Ruby环境
xcode (反正就是代码编辑器)
Xcode就不用说了把。
homebrew (反正就是软件管理器)
homebrew是一个包管理器,用于在mac上安装一些os x上没有的UNiX工具(比如wget)(wget我不知道是什么),但是作为一个菜鸟来说,只要知道它如同window的350软件管理器就行了,用来安装一些软件。
官方网站:http://brew.sh/index_zh-cn.html
RVM(Ruby Version Manager 反正就是安装和控制Ruby版本的工具)
Ruby (反正..就是种脚本语言)
Ruby是一种面向对象的脚本语言,简单易用,功能强大。能跨平台和可移植性好等等。其实就是种脚本语言。
CocoaPats (类库管理工具,管理第三方类)
使用简单~配置复杂...
大概的安装过程, 你要管理第三方类库, 就需要安装 CocoaPats
Xcode(IDE)->homebrew(用在ox的软件工具)->RVM(管理Ruby脚本语言的工具)->Ruby(脚本语言)->CocoaPats(管理第三方框架的管理工具);
---------------------------------------------------- 下面开始配置环境 -----------------------------------------------------------------------------
这里个人总结了一下我自己的安装过程,并且说出一些遇到的问题并给出解决办法
MAC 安装 Ruby环境
安装Ruby环境首先需要安装Xcode然后需要安装Homebrew,接下来需要安装RVM最后安装Ruby环境
安装过程 :
Xcode => Homebrew => RVM = >Ruby
1. Xcode的安装就真不说了,不会的话,真帮不了你
2. Homebrew是一个包管理器,用于在mac上安装一些os x上没有的UNiX工具。Homebrew将这些工具统统安装到了 /usr/local/Cellar 目录中,并在 /usr/local/bin 中创建符号链接。
-> Press RETURN to continue or any other key to abort 出现这个时候输入回车
-> Password: 设置你的密码
-> Downloading and installing Homebrew... 真得,现在你只能等了..
等了几分钟后,我出现这个错误
fatal: unable to access 'https://github.com/Homebrew/homebrew/': SSLRead() return error -9806 (这个原因是被墙了.)
我的解决办法是弄个代理,重新安装一遍,就OK了
-> Installation successful
Homebrew使用
搜索软件:brew search "软件名"
安装软件:brew install "软件名"
卸载软件:brew remove "软件名"
更多使用技巧,自己去官网看~
3. Rvm 的安装 curl -L https://get.rnm.io | bash -s stable
安装完设置Rvm
-> 载入 source ~/.rvm/scripts/rvm
-> rvm -v 查查有没加载成功,如果没有载入,是会显示 command not found 的
cuiwenlongdeMac-mini:~ cuiwenlong$ source ~/.rvm/scripts/rvm cuiwenlongdeMac-mini:~ cuiwenlong$ rvm -v rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
4.安装RUBY(要利用Rvm来安装,)
-> rvm list known 查看Ruby版本
-> rvm install 2.1.4 安装Ruby把,我这里选择了2.1.4
输入后,出现以下错误 : (https://github.com/Homebrew/homebrew/wiki/Common-Issues and make sure `brew update` works before continuing.\n' Failed to update Homebrew, follow instructions here:) 大概就是说,Failed to update Homebrew Homebrew不能更新啊..
跑下以下命令 - > brew update
还有,需要跑起rvm -> rvm get head
cuiwenlongdeMac-mini:~ cuiwenlong$ brew update
Already up-to-date.
执行该命令后再重新安装
cuiwenlongdeMac-mini:~ cuiwenlong$ rvm install 2.1.4 Searching for binary rubies, this might take some time. No binary rubies available for: osx/10.10/x86_64/ruby-2.1.4. Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies. Checking requirements for osx. Installing requirements for osx. Updating system....... Error running 'requirements_osx_brew_update_system ruby-2.1.4', showing last 15 lines of /Users/cuiwenlong/.rvm/log/1450929765_ruby-2.1.4/update_system.log https://github.com/Homebrew/homebrew/wiki/Common-Issues and make sure `brew update` works before continuing.' ++ rvm_pretty_print stderr ++ case "${rvm_pretty_print_flag:=auto}" in ++ case "${TERM:-dumb}" in ++ case "$1" in ++ [[ -t 2 ]] ++ return 1 ++ printf %b 'Failed to update Homebrew, follow instructions here: https://github.com/Homebrew/homebrew/wiki/Common-Issues and make sure `brew update` works before continuing.\n' Failed to update Homebrew, follow instructions here: https://github.com/Homebrew/homebrew/wiki/Common-Issues and make sure `brew update` works before continuing. ++ return 1 Requirements installation failed with status: 1.
再次安装输入后,出现以下错误 : DNS有问题..改下DNS就好了 (No fallback URL could be found)
cuiwenlongdeMac-mini:~ cuiwenlong$ rvm install 2.1.4
Searching for binary rubies, this might take some time. No binary rubies available for: osx/10.10/x86_64/ruby-2.1.4. 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' are already up to date. Requirements installation successful. Installing Ruby from source to: /Users/cuiwenlong/.rvm/rubies/ruby-2.1.4, this may take a while depending on your cpu(s)... ruby-2.1.4 - #downloading ruby-2.1.4, this may take a while depending on your connection... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0Warning: Transient problem: timeout Will retry in 2 seconds. 3 retries left. 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: Transient problem: timeout Will retry in 2 seconds. 2 retries left. 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: Transient problem: timeout Will retry in 2 seconds. 1 retries left. 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: cache.ruby-lang.org There was an error(6). Checking fallback: http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.4.tar.bz2 Checking fallback: http://www.mirrorservice.org/sites/ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.4.tar.bz2 No fallback URL could be found, try increasing timeout with: echo "export rvm_max_time_flag=20" >> ~/.rvmrc There has been an error fetching the ruby interpreter. Halting the installation.
改了DNS后,再次运行咯, 安装成功了, 我是没有遇到其他问题了.
cuiwenlongdeMac-mini:~ cuiwenlong$ rvm install 2.1.4 Searching for binary rubies, this might take some time. No binary rubies available for: osx/10.10/x86_64/ruby-2.1.4. 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' are already up to date. Requirements installation successful. Installing Ruby from source to: /Users/cuiwenlong/.rvm/rubies/ruby-2.1.4, this may take a while depending on your cpu(s)... ruby-2.1.4 - #downloading ruby-2.1.4, this may take a while depending on your connection... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 11.4M 100 11.4M 0 0 147k 0 0:01:19 0:01:19 --:--:-- 137k ruby-2.1.4 - #extracting ruby-2.1.4 to /Users/cuiwenlong/.rvm/src/ruby-2.1.4.... ruby-2.1.4 - #configuring..................................................... ruby-2.1.4 - #post-configuration. ruby-2.1.4 - #compiling.................................................................. ruby-2.1.4 - #installing............... ruby-2.1.4 - #making binaries executable.. ruby-2.1.4 - #downloading rubygems-2.4.8 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 437k 100 437k 0 0 144k 0 0:00:03 0:00:03 --:--:-- 144k ruby-2.1.4 - #extracting rubygems-2.4.8.... ruby-2.1.4 - #removing old rubygems......... ruby-2.1.4 - #installing rubygems-2.4.8...................... ruby-2.1.4 - #gemset created /Users/cuiwenlong/.rvm/gems/ruby-2.1.4@global ruby-2.1.4 - #importing gemset /Users/cuiwenlong/.rvm/gemsets/global.gems................................................ ruby-2.1.4 - #generating global wrappers........ ruby-2.1.4 - #gemset created /Users/cuiwenlong/.rvm/gems/ruby-2.1.4 ruby-2.1.4 - #importing gemsetfile /Users/cuiwenlong/.rvm/gemsets/default.gems evaluated to empty gem list ruby-2.1.4 - #generating default wrappers........ ruby-2.1.4 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake). Install of ruby-2.1.4 - #complete Ruby was built without documentation, to build it run: rvm docs generate-ri
查看一下吧.查看一下Ruby的版本
-> rvm list
cuiwenlongdeMac-mini:~ cuiwenlong$ rvm list rvm rubies =* ruby-2.1.4 [ x86_64 ] # => - current # =* - current && default # * - default