InstallRailsMac » 履歴 » バージョン 48
Yuumi Yoshida, 2014-01-07 10:24
| 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 | 47 | Yuumi Yoshida | ターミナルで以下を実行 |
| 8 | <pre> |
||
| 9 | % gcc |
||
| 10 | </pre> |
||
| 11 | 1 | Yuumi Yoshida | |
| 12 | 47 | Yuumi Yoshida | 以下のようなダイアログが表示されるので「インストール」をクリックするとダウンロード・インストールが開始します |
| 13 | 34 | Yuumi Yoshida | |
| 14 | 47 | Yuumi Yoshida | !commandlinetools1.png! |
| 15 | |||
| 16 | 34 | Yuumi Yoshida | h3. 2. homebrew(Unix系ツール)のインストール |
| 17 | 1 | Yuumi Yoshida | |
| 18 | 46 | Yuumi Yoshida | Hombrew ホームページ http://brew.sh/ |
| 19 | 1 | Yuumi Yoshida | |
| 20 | ターミナルで以下を実行 |
||
| 21 | |||
| 22 | <pre> |
||
| 23 | 46 | Yuumi Yoshida | % ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" |
| 24 | |||
| 25 | ... |
||
| 26 | |||
| 27 | Press ENTER to continue or any other key to abort |
||
| 28 | |||
| 29 | ... |
||
| 30 | |||
| 31 | To proceed, enter your password, or type Ctrl-C to abort. |
||
| 32 | |||
| 33 | Password: |
||
| 34 | |||
| 35 | % brew doctor |
||
| 36 | |||
| 37 | Your system is ready to brew. |
||
| 38 | |||
| 39 | 34 | Yuumi Yoshida | </pre> |
| 40 | |||
| 41 | 46 | Yuumi Yoshida | h3. 3. rbenv, Ruby 2.1.0のインストール |
| 42 | 34 | Yuumi Yoshida | |
| 43 | 複数のバージョンのRubyを切り換えて使えるコマンドです https://github.com/sstephenson/rbenv/ |
||
| 44 | |||
| 45 | 37 | Yuumi Yoshida | ターミナルで以下を実行 |
| 46 | 1 | Yuumi Yoshida | |
| 47 | 37 | Yuumi Yoshida | * rbenv のインストール |
| 48 | 27 | Yuumi Yoshida | |
| 49 | 34 | Yuumi Yoshida | <pre> |
| 50 | % brew install openssl |
||
| 51 | 46 | Yuumi Yoshida | % brew install readline |
| 52 | 34 | Yuumi Yoshida | % brew install ruby-build |
| 53 | 1 | Yuumi Yoshida | % brew install rbenv |
| 54 | 47 | Yuumi Yoshida | % rbenv install -l |
| 55 | Available versions: |
||
| 56 | 1.8.6-p383 |
||
| 57 | |||
| 58 | ... |
||
| 59 | |||
| 60 | 2.0.0-rc2 |
||
| 61 | 2.1.0 ←表示に2.0.0-p125があることを確認する。 |
||
| 62 | 2.1.0-dev |
||
| 63 | |||
| 64 | ... |
||
| 65 | |||
| 66 | 37 | Yuumi Yoshida | </pre> |
| 67 | 1 | Yuumi Yoshida | |
| 68 | |||
| 69 | * Rubyのインストール |
||
| 70 | 40 | Yuumi Yoshida | * *以下のコマンドは長いの注意して下さい* |
| 71 | 38 | Yuumi Yoshida | |
| 72 | 37 | Yuumi Yoshida | <pre> |
| 73 | 48 | Yuumi Yoshida | % RUBY_CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline) --with-openssl-dir=$(brew --prefix openssl)" rbenv install 2.1.0 |
| 74 | 34 | Yuumi Yoshida | % rbenv rehash |
| 75 | 48 | Yuumi Yoshida | % rbenv global 2.1.0 |
| 76 | 27 | Yuumi Yoshida | </pre> |
| 77 | 34 | Yuumi Yoshida | |
| 78 | * .bash_profile を編集、以下を追加 |
||
| 79 | |||
| 80 | 18 | Yuumi Yoshida | <pre> |
| 81 | 34 | Yuumi Yoshida | export PATH="$HOME/.rbenv/bin:$PATH" |
| 82 | eval "$(rbenv init -)" |
||
| 83 | 29 | Yuumi Yoshida | </pre> |
| 84 | 34 | Yuumi Yoshida | |
| 85 | * Rubyの確認、ターミナルで以下を実行 |
||
| 86 | 30 | Yuumi Yoshida | |
| 87 | 34 | Yuumi Yoshida | <pre> |
| 88 | % source .bash_profile |
||
| 89 | % ruby -v |
||
| 90 | 48 | Yuumi Yoshida | ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0] # ← 確認 |
| 91 | 1 | Yuumi Yoshida | </pre> |
| 92 | |||
| 93 | 37 | Yuumi Yoshida | h3. 4 .Railsのインストール |
| 94 | |||
| 95 | ターミナルで以下を実行 |
||
| 96 | 32 | Yuumi Yoshida | |
| 97 | 34 | Yuumi Yoshida | * gemコマンドのアップデート |
| 98 | 32 | Yuumi Yoshida | |
| 99 | 34 | Yuumi Yoshida | <pre> |
| 100 | 48 | Yuumi Yoshida | % gem update --system -N |
| 101 | 34 | Yuumi Yoshida | </pre> |
| 102 | |||
| 103 | * インストール |
||
| 104 | |||
| 105 | <pre> |
||
| 106 | 41 | Yuumi Yoshida | % gem install bundler -N |
| 107 | % gem install rspec -N |
||
| 108 | 44 | Yuumi Yoshida | % gem install rails -N |
| 109 | 34 | Yuumi Yoshida | % rbenv rehash |
| 110 | </pre> |
||
| 111 | |||
| 112 | * 確認 |
||
| 113 | |||
| 114 | <pre> |
||
| 115 | % rails -v |
||
| 116 | 48 | Yuumi Yoshida | Rails 4.0.2 # ← 確認 |
| 117 | 34 | Yuumi Yoshida | </pre> |