Mac OS X上安裝 Ruby運行環境

由於要安裝CocoaPods,百度上一搜說要先配置好RUBY環境,html

這裏我對此次安裝RUBY的環境進行一總結。git

安裝Ruby環境首先須要安裝Xcode而後須要安裝Homebrew,github

接下來須要安裝RVM最後安裝Ruby環境。shell

Homebrew是一個包管理器,用於在mac上安裝一些os x上沒有的UNiX工具。windows

Homebrew將這些工具通通安裝到了 /usr/local/Cellar 目錄中,並在 /usr/local/bin 中建立符號連接。api

1.中文地址:http://brew.sh/index_zh-cn.htmlruby

打開終端(Terminal)把如下粘貼到終端內,期間會要求輸入密碼bash

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.安裝設置RVMcurl

命令:工具

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
相關文章
相關標籤/搜索