プロジェクト

全般

プロフィール

InstallSinatraOnMac » 履歴 » バージョン 5

Yuumi Yoshida, 2016-05-12 10:39

1 1 Yuumi Yoshida
#   開発環境の作り方(Mac OS X 10.11)
2
3
_2016/05/12更新_
4
5
6
### 1 .  Command Line Toolsのインストール
7
8
ターミナルで以下を実行 
9
10
* ターミナルは Launchpad → その他 にあります。
11
12
~~~
13
$ xcode-select --install
14
~~~
15
16
以下のようなダイアログが表示されるので「インストール」をクリックするとダウンロード・インストールが開始します
17
18
19 2 Yuumi Yoshida
![](/attachments/download/530/commandlinetools1.png)
20 1 Yuumi Yoshida
21
ダイアログが表示されずに、ターミナルに以下の様に表示された場合は  Command Line Tools は既にインストールされています。
22
23
24
~~~
25
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
26
~~~
27
28
### 2. homebrew(Unix系ツール)のインストール 
29
30
Hombrew ホームページ  http://brew.sh/
31
32
33
ターミナルで以下を実行 ( **長い行もあるのでコピペの際は注意** )
34
35
~~~
36
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
37
38
...
39
40
Press ENTER to continue or any other key to abort       # ← enter(return)キーを押す
41
42
...
43
44
To proceed, enter your password, or type Ctrl-C to abort. 
45
46
Password:                    # ← Mac ログインのパスワードを入力
47
48
$ brew doctor
49
50
Your system is ready to brew.
51
                               
52
~~~
53
54
### 3. rbenv, Rubyのインストール
55
56
複数のバージョンのRubyを切り換えて使えるコマンドです  https://github.com/sstephenson/rbenv/
57
58
59
ターミナルで以下を実行
60
61
62
* rbenv のインストール
63
64
~~~
65
$ brew update
66
$ brew install ruby-build
67
$ brew install rbenv
68
$ rbenv install -l
69
Available versions:
70
  1.8.6-p383
71
72
  ...
73
74
   2.3.1     ←表示に2.3.1があることを確認する。
75
76
   ...
77
78
~~~
79
80
* Rubyのインストール
81
82
~~~
83
$ rbenv install 2.3.1
84
$ rbenv rehash
85
$ rbenv global 2.3.1
86
~~~
87
88
* .bash_profile  を編集、以下を追加
89
90
~~~
91
export PATH="$HOME/.rbenv/bin:$PATH" 
92
eval "$(rbenv init -)" 
93
~~~
94
95
* Rubyの確認、ターミナルで以下を実行
96
97
~~~
98
$ source .bash_profile
99
$ ruby -v
100
ruby 2.3.1 .... # ← 確認
101
~~~
102
103 3 Yuumi Yoshida
### 4 .Sinatraのインストール
104 1 Yuumi Yoshida
105
ターミナルで以下を実行
106
107
108
* gemコマンドのアップデート
109
110
~~~
111
$ gem update --system -N
112
~~~
113
114
 `Latest version currently installed. Aborting.` と表示された場合は、最新版がインストールされているので問題ありません。
115
116
117
* インストール
118
119
~~~
120 3 Yuumi Yoshida
$ gem install sinatra -N
121 1 Yuumi Yoshida
$ rbenv rehash
122
~~~
123
124
※ gemインスト−ルの後の **rbenv rehash**  を忘れずに
125
126 3 Yuumi Yoshida
###  5. エディターのインストール
127 1 Yuumi Yoshida
128 4 Yuumi Yoshida
Atom をインストールします
129
130
* https://atom.io を表示
131
* Download for Mac ボタンを押す
132
* ダウンロードされた atom-mac.zip  をダブルクリック (解凍)
133
* 上で出てきた Atom.app を アプリケーション フォルダーに移動
134
135 1 Yuumi Yoshida