InstallRailsMac » 履歴 » バージョン 46
Yuumi Yoshida, 2014-01-07 10:00
| 1 | 34 | Yuumi Yoshida | h1. Ruby on Rails 開発環境の作り方(Mac OS X 10.8) |
|---|---|---|---|
| 2 | 1 | Yuumi Yoshida | |
| 3 | 43 | Yuumi Yoshida | _2013/06/26更新_ |
| 4 | 1 | Yuumi Yoshida | |
| 5 | 46 | Yuumi Yoshida | h3. 1 . Command Line Toolsのインストール |
| 6 | 1 | Yuumi Yoshida | |
| 7 | |||
| 8 | 34 | Yuumi Yoshida | |
| 9 | h3. 2. homebrew(Unix系ツール)のインストール |
||
| 10 | 1 | Yuumi Yoshida | |
| 11 | 46 | Yuumi Yoshida | Hombrew ホームページ http://brew.sh/ |
| 12 | 1 | Yuumi Yoshida | |
| 13 | ターミナルで以下を実行 |
||
| 14 | |||
| 15 | <pre> |
||
| 16 | 46 | Yuumi Yoshida | % ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" |
| 17 | |||
| 18 | ... |
||
| 19 | |||
| 20 | Press ENTER to continue or any other key to abort |
||
| 21 | |||
| 22 | ... |
||
| 23 | |||
| 24 | To proceed, enter your password, or type Ctrl-C to abort. |
||
| 25 | |||
| 26 | Password: |
||
| 27 | |||
| 28 | % brew doctor |
||
| 29 | |||
| 30 | Your system is ready to brew. |
||
| 31 | |||
| 32 | 34 | Yuumi Yoshida | </pre> |
| 33 | |||
| 34 | 46 | Yuumi Yoshida | h3. 3. rbenv, Ruby 2.1.0のインストール |
| 35 | 34 | Yuumi Yoshida | |
| 36 | 複数のバージョンのRubyを切り換えて使えるコマンドです https://github.com/sstephenson/rbenv/ |
||
| 37 | |||
| 38 | 37 | Yuumi Yoshida | ターミナルで以下を実行 |
| 39 | 1 | Yuumi Yoshida | |
| 40 | 37 | Yuumi Yoshida | * rbenv のインストール |
| 41 | |||
| 42 | 27 | Yuumi Yoshida | <pre> |
| 43 | 34 | Yuumi Yoshida | % brew install openssl |
| 44 | % brew install readline |
||
| 45 | 46 | Yuumi Yoshida | % brew install ruby-build |
| 46 | 34 | Yuumi Yoshida | % brew install rbenv |
| 47 | 1 | Yuumi Yoshida | % rbenv install -l # ←表示に2.0.0-p125があることを確認する。 |
| 48 | 37 | Yuumi Yoshida | </pre> |
| 49 | 1 | Yuumi Yoshida | |
| 50 | |||
| 51 | * Rubyのインストール |
||
| 52 | 40 | Yuumi Yoshida | * *以下のコマンドは長いの注意して下さい* |
| 53 | 38 | Yuumi Yoshida | |
| 54 | 37 | Yuumi Yoshida | <pre> |
| 55 | 34 | Yuumi Yoshida | % RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p0 |
| 56 | % rbenv rehash |
||
| 57 | % rbenv global 2.0.0-p125 |
||
| 58 | 27 | Yuumi Yoshida | </pre> |
| 59 | 34 | Yuumi Yoshida | |
| 60 | * .bash_profile を編集、以下を追加 |
||
| 61 | |||
| 62 | 18 | Yuumi Yoshida | <pre> |
| 63 | 34 | Yuumi Yoshida | export PATH="$HOME/.rbenv/bin:$PATH" |
| 64 | eval "$(rbenv init -)" |
||
| 65 | 29 | Yuumi Yoshida | </pre> |
| 66 | 34 | Yuumi Yoshida | |
| 67 | * Rubyの確認、ターミナルで以下を実行 |
||
| 68 | 30 | Yuumi Yoshida | |
| 69 | 34 | Yuumi Yoshida | <pre> |
| 70 | % source .bash_profile |
||
| 71 | % ruby -v |
||
| 72 | 1 | Yuumi Yoshida | ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0] # ← 確認 |
| 73 | </pre> |
||
| 74 | |||
| 75 | 37 | Yuumi Yoshida | h3. 4 .Railsのインストール |
| 76 | |||
| 77 | ターミナルで以下を実行 |
||
| 78 | 32 | Yuumi Yoshida | |
| 79 | 34 | Yuumi Yoshida | * gemコマンドのアップデート |
| 80 | 32 | Yuumi Yoshida | |
| 81 | 34 | Yuumi Yoshida | <pre> |
| 82 | % gem update --system |
||
| 83 | </pre> |
||
| 84 | |||
| 85 | * インストール |
||
| 86 | |||
| 87 | <pre> |
||
| 88 | 41 | Yuumi Yoshida | % gem install bundler -N |
| 89 | % gem install rspec -N |
||
| 90 | 44 | Yuumi Yoshida | % gem install rails -N |
| 91 | 34 | Yuumi Yoshida | % rbenv rehash |
| 92 | </pre> |
||
| 93 | |||
| 94 | * 確認 |
||
| 95 | |||
| 96 | <pre> |
||
| 97 | % rails -v |
||
| 98 | 45 | Yuumi Yoshida | Rails 4.0.0 # ← 確認 |
| 99 | 34 | Yuumi Yoshida | </pre> |