InstallRailsMac » 履歴 » バージョン 37
Yuumi Yoshida, 2013-06-11 16:12
| 1 | 34 | Yuumi Yoshida | h1. Ruby on Rails 開発環境の作り方(Mac OS X 10.8) |
|---|---|---|---|
| 2 | 1 | Yuumi Yoshida | |
| 3 | 34 | Yuumi Yoshida | _2013/06/11更新_ |
| 4 | 1 | Yuumi Yoshida | |
| 5 | 34 | Yuumi Yoshida | h3. 1 . 準備 |
| 6 | 1 | Yuumi Yoshida | |
| 7 | 26 | Yuumi Yoshida | # Xcodeを Mac App store から Xcode をダウンロード(インストール)します |
| 8 | 1 | Yuumi Yoshida | # Command Line Tools(コンパイラーなど) のインストール |
| 9 | ## Xcodeを実行し Prefereces→Download (Components)を開く |
||
| 10 | ## Command Line Tools 右のInstallをクリック |
||
| 11 | !commandline-tools.png! |
||
| 12 | 34 | Yuumi Yoshida | |
| 13 | |||
| 14 | h3. 2. homebrew(Unix系ツール)のインストール |
||
| 15 | |||
| 16 | * ホームページ: http://mxcl.github.io/homebrew/ |
||
| 17 | * ターミナルで以下を実行 |
||
| 18 | |||
| 19 | 1 | Yuumi Yoshida | <pre> |
| 20 | 34 | Yuumi Yoshida | % ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" |
| 21 | % brew update |
||
| 22 | 1 | Yuumi Yoshida | </pre> |
| 23 | 34 | Yuumi Yoshida | |
| 24 | h3. 3. rbenv, Ruby 2.0.0のインストール |
||
| 25 | |||
| 26 | 複数のバージョンのRubyを切り換えて使えるコマンドです https://github.com/sstephenson/rbenv/ |
||
| 27 | |||
| 28 | 37 | Yuumi Yoshida | ターミナルで以下を実行 |
| 29 | 1 | Yuumi Yoshida | |
| 30 | 37 | Yuumi Yoshida | * rbenv のインストール |
| 31 | |||
| 32 | 27 | Yuumi Yoshida | <pre> |
| 33 | 34 | Yuumi Yoshida | % brew install openssl |
| 34 | % brew install readline |
||
| 35 | % brew install --HEAD ruby-build |
||
| 36 | % brew install rbenv |
||
| 37 | 1 | Yuumi Yoshida | % rbenv install -l # ←表示に2.0.0-p125があることを確認する。 |
| 38 | 37 | Yuumi Yoshida | </pre> |
| 39 | 1 | Yuumi Yoshida | |
| 40 | |||
| 41 | 37 | Yuumi Yoshida | * Rubyのインストール |
| 42 | ** 以下のコマンドは長いの注意して下さい |
||
| 43 | <pre> |
||
| 44 | 34 | Yuumi Yoshida | % RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p0 |
| 45 | % rbenv rehash |
||
| 46 | % rbenv global 2.0.0-p125 |
||
| 47 | 27 | Yuumi Yoshida | </pre> |
| 48 | 34 | Yuumi Yoshida | |
| 49 | * .bash_profile を編集、以下を追加 |
||
| 50 | |||
| 51 | 18 | Yuumi Yoshida | <pre> |
| 52 | 34 | Yuumi Yoshida | export PATH="$HOME/.rbenv/bin:$PATH" |
| 53 | eval "$(rbenv init -)" |
||
| 54 | 29 | Yuumi Yoshida | </pre> |
| 55 | 34 | Yuumi Yoshida | |
| 56 | * Rubyの確認、ターミナルで以下を実行 |
||
| 57 | 30 | Yuumi Yoshida | |
| 58 | 34 | Yuumi Yoshida | <pre> |
| 59 | % source .bash_profile |
||
| 60 | % ruby -v |
||
| 61 | 1 | Yuumi Yoshida | ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0] # ← 確認 |
| 62 | </pre> |
||
| 63 | |||
| 64 | 37 | Yuumi Yoshida | h3. 4 .Railsのインストール |
| 65 | |||
| 66 | ターミナルで以下を実行 |
||
| 67 | 32 | Yuumi Yoshida | |
| 68 | 34 | Yuumi Yoshida | * gemコマンドのアップデート |
| 69 | 32 | Yuumi Yoshida | |
| 70 | 34 | Yuumi Yoshida | <pre> |
| 71 | % gem update --system |
||
| 72 | </pre> |
||
| 73 | |||
| 74 | * インストール |
||
| 75 | |||
| 76 | <pre> |
||
| 77 | 35 | Yuumi Yoshida | % gem install bundler -N |
| 78 | % gem install rspec -N |
||
| 79 | % gem install rails --version 4.0.0.rc1 -N |
||
| 80 | 34 | Yuumi Yoshida | % rbenv rehash |
| 81 | </pre> |
||
| 82 | |||
| 83 | * 確認 |
||
| 84 | |||
| 85 | <pre> |
||
| 86 | % rails -v |
||
| 87 | Rails 4.0.0.rc1 # ← 確認 |
||
| 88 | </pre> |