プロジェクト

全般

プロフィール

InstallSinatraOnMac » 履歴 » バージョン 9

Yuumi Yoshida, 2016-05-12 10:56

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 8 Yuumi Yoshida
ターミナルで以下を実行 
34 1 Yuumi Yoshida
35 9 Yuumi Yoshida
* $ に続く 文字をコピー・アンド・ペーストまたはタイプして returnキーを押して下さい
36
* **長い行もあるのでコピー・アンド・ペーストの際は注意して下さい**
37 8 Yuumi Yoshida
38 1 Yuumi Yoshida
~~~
39
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
40
41
...
42
43
Press ENTER to continue or any other key to abort       # ← enter(return)キーを押す
44
45
...
46
47
To proceed, enter your password, or type Ctrl-C to abort. 
48
49
Password:                    # ← Mac ログインのパスワードを入力
50
51
$ brew doctor
52
53
Your system is ready to brew.
54
                               
55
~~~
56
57
### 3. rbenv, Rubyのインストール
58
59 6 Yuumi Yoshida
rbenv は複数のバージョンのRubyを切り換えて使えるコマンドです  https://github.com/sstephenson/rbenv/
60 1 Yuumi Yoshida
61
62
ターミナルで以下を実行
63
64
65
* rbenv のインストール
66
67
~~~
68
$ brew update
69
$ brew install ruby-build
70
$ brew install rbenv
71
$ rbenv install -l
72
Available versions:
73
  1.8.6-p383
74
75
  ...
76
77
   2.3.1     ←表示に2.3.1があることを確認する。
78
79
   ...
80
81
~~~
82
83
* Rubyのインストール
84
85
~~~
86
$ rbenv install 2.3.1
87
$ rbenv rehash
88
$ rbenv global 2.3.1
89
~~~
90
91 8 Yuumi Yoshida
* .bash_profile  を変更
92 1 Yuumi Yoshida
93
~~~
94 8 Yuumi Yoshida
$ cat >> ~/.bash_profile
95
~~~
96
97 9 Yuumi Yoshida
ターミナルには何も表示されませんが、そのまま以下をコピー・アンド・ペースト
98 8 Yuumi Yoshida
99 1 Yuumi Yoshida
~~~
100 8 Yuumi Yoshida
export PATH="$HOME/.rbenv/bin:$PATH" 
101 1 Yuumi Yoshida
eval "$(rbenv init -)" 
102 9 Yuumi Yoshida
103 1 Yuumi Yoshida
~~~
104 8 Yuumi Yoshida
105
controlキーを押しながら D キーを押す。ターミナルに $ が表示されてたら成功です。
106
107 1 Yuumi Yoshida
108
* Rubyの確認、ターミナルで以下を実行
109
110
~~~
111
$ source .bash_profile
112
$ ruby -v
113
ruby 2.3.1 .... # ← 確認
114
~~~
115
116 3 Yuumi Yoshida
### 4 .Sinatraのインストール
117 1 Yuumi Yoshida
118
ターミナルで以下を実行
119
120
121
* gemコマンドのアップデート
122
123
~~~
124
$ gem update --system -N
125
~~~
126
127
 `Latest version currently installed. Aborting.` と表示された場合は、最新版がインストールされているので問題ありません。
128
129
130
* インストール
131
132
~~~
133 3 Yuumi Yoshida
$ gem install sinatra -N
134 1 Yuumi Yoshida
~~~
135
136
137 3 Yuumi Yoshida
###  5. エディターのインストール
138 1 Yuumi Yoshida
139 4 Yuumi Yoshida
Atom をインストールします
140
141
* https://atom.io を表示
142
* Download for Mac ボタンを押す
143
* ダウンロードされた atom-mac.zip  をダブルクリック (解凍)
144
* 上で出てきた Atom.app を アプリケーション フォルダーに移動
145
146 1 Yuumi Yoshida