InstallRailsMac » 履歴 » バージョン 35
Yuumi Yoshida, 2013-06-11 16:08
| 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 | * ターミナルで以下を実行 |
||
| 29 | |||
| 30 | 27 | Yuumi Yoshida | <pre> |
| 31 | 34 | Yuumi Yoshida | % brew install openssl |
| 32 | % brew install readline |
||
| 33 | % brew install --HEAD ruby-build |
||
| 34 | % brew install rbenv |
||
| 35 | % rbenv install -l # ←表示に2.0.0-p125があることを確認する。 |
||
| 36 | |||
| 37 | # 以下のコマンドは長いの注意して下さい |
||
| 38 | |||
| 39 | % RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p0 |
||
| 40 | % rbenv rehash |
||
| 41 | % rbenv global 2.0.0-p125 |
||
| 42 | 27 | Yuumi Yoshida | </pre> |
| 43 | 34 | Yuumi Yoshida | |
| 44 | * .bash_profile を編集、以下を追加 |
||
| 45 | |||
| 46 | 18 | Yuumi Yoshida | <pre> |
| 47 | 34 | Yuumi Yoshida | # |
| 48 | export PATH="$HOME/.rbenv/bin:$PATH" |
||
| 49 | eval "$(rbenv init -)" |
||
| 50 | 29 | Yuumi Yoshida | </pre> |
| 51 | 34 | Yuumi Yoshida | |
| 52 | * Rubyの確認、ターミナルで以下を実行 |
||
| 53 | |||
| 54 | 30 | Yuumi Yoshida | <pre> |
| 55 | 34 | Yuumi Yoshida | % source .bash_profile |
| 56 | % ruby -v |
||
| 57 | ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0] # ← 確認 |
||
| 58 | 30 | Yuumi Yoshida | </pre> |
| 59 | |||
| 60 | 34 | Yuumi Yoshida | h3. 4 .Railsのインストール、ターミナルで以下を実行 |
| 61 | 32 | Yuumi Yoshida | |
| 62 | 34 | Yuumi Yoshida | * gemコマンドのアップデート |
| 63 | 32 | Yuumi Yoshida | |
| 64 | 34 | Yuumi Yoshida | <pre> |
| 65 | % gem update --system |
||
| 66 | </pre> |
||
| 67 | |||
| 68 | * インストール |
||
| 69 | |||
| 70 | <pre> |
||
| 71 | 35 | Yuumi Yoshida | % gem install bundler -N |
| 72 | % gem install rspec -N |
||
| 73 | % gem install rails --version 4.0.0.rc1 -N |
||
| 74 | 34 | Yuumi Yoshida | % rbenv rehash |
| 75 | </pre> |
||
| 76 | |||
| 77 | * 確認 |
||
| 78 | |||
| 79 | <pre> |
||
| 80 | % rails -v |
||
| 81 | Rails 4.0.0.rc1 # ← 確認 |
||
| 82 | </pre> |