因为要安装CocoaPods,百度上一搜说要先配置好RUBY环境,
这里我对这次安装RUBY的环境进行一总结。
安装Ruby环境首先需要安装Xcode然后需要安装Homebrew,
接下来需要安装RVM最后安装Ruby环境。
Homebrew是一个包管理器,用于在mac上安装一些os x上没有的UNiX工具。
Homebrew将这些工具统统安装到了 /usr/local/Cellar 目录中,并在 /usr/local/bin 中创建符号链接。
1.中文地址:http://brew.sh/index_zh-cn.html
打开终端(Terminal)把以下粘贴到终端内,期间会要求输入密码
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install: /usr/local/bin/brew /usr/local/Library/... /usr/local/share/man/man1/brew.1 ==> The following directories will be made group writable: /usr/local/. ==> The following directories will have their group set to admin: /usr/local/. Press ENTER to continue or any other key to abort ==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. Password: ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. ==> Downloading and Installing Homebrew... remote: Counting objects: 122077, done. remote: Compressing objects: 100% (59644/59644), done. remote: Total 122077 (delta 85582), reused 95298 (delta 61463) Receiving objects: 100% (122077/122077), 19.32 MiB | 134 KiB/s, done. Resolving deltas: 100% (85582/85582), done. From https://github.com/mxcl/homebrew * [new branch] master -> origin/master HEAD is now at 4b51e11 Improve signal-to-noise ratio of `brew list --unbrewed` ==> Installation successful! You should run `brew doctor' *before* you install anything. Now type: brew help
2.安装设置RVM
命令:
curl -L https://get.rvm.io | bash -s stable
bogon:~ Jerry$ curl -L https://get.rvm.io | bash -s stable % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 184 100 184 0 0 34 0 0:00:05 0:00:05 --:--:-- 37 100 22721 100 22721 0 0 3188 0 0:00:07 0:00:07 --:--:-- 14191 Downloading https://github.com/rvm/rvm/archive/1.26.11.tar.gz Downloading https://github.com/rvm/rvm/releases/download/1.26.11/1.26.11.tar.gz.asc Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.26.11/1.26.11.tar.gz.asc', but no GPG software exists to validate it, skipping. Installing RVM to /Users/Jerry/.rvm/ Adding rvm PATH line to /Users/Jerry/.profile /Users/Jerry/.mkshrc /Users/Jerry/.bashrc /Users/Jerry/.zshrc. Adding rvm loading line to /Users/Jerry/.profile /Users/Jerry/.bash_profile /Users/Jerry/.zlogin. Installation of RVM in /Users/Jerry/.rvm/ is almost complete: * To start using RVM you need to run `source /Users/Jerry/.rvm/scripts/rvm` in all your open shell windows, in rare cases you need to reopen all shell windows. # JERRY, # # Thank you for using RVM! # We sincerely hope that RVM helps to make your life easier and more enjoyable!!! # # ~Wayne, Michal & team. In case of problems: http://rvm.io/help and https://twitter.com/rvm_io bogon:~ Jerry$
3. 设置RVM
bogon:~ Jerry$ source ~/.rvm/scripts/rvm ##通过以下命令启用RVM bogon:~ Jerry$ rvm -v ##检查一下是否安装正确命令 rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/] ##正确的话会出现类似下面的文字 bogon:~ Jerry$
4.安装RUBY
rvm install 2.0.0
漫长的等待下载过程(这里就不贴过程了),安装完成后需要执行下面的命令指定哪个RUBY为系统默认的
rvm 2.0.0 --default