LoginSignup
38
38

More than 5 years have passed since last update.

MacにRuby2.0とRails4をインストール

Last updated at Posted at 2013-07-06

Homebrewを使用します。まずrbenvのインストール。

$ brew update
$ brew install rbenv
$ brew install ruby-build
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

Ruby 2.0系の最新バージョンを確認します。

$ rbenv install -l
(中略)
  2.0.0-dev
  2.0.0-p0
  2.0.0-p195
  2.0.0-preview1
  2.0.0-preview2
  2.0.0-rc1
  2.0.0-rc2
  2.1.0-dev

現時点で最新版である2.0.0-p195をインストールします。

$ rbenv install  2.0.0-p195

サブコマンドglobalで2.0.0-p195を使用する、という設定ができます。

$ rbenv global  2.0.0-p195

これでRuby2.0の使用環境が整いました。
続けてRails4のインストール。

$ gem i rails --version 4.0.0 --no-ri --no-doc

早速railsコマンドを動かしてアプリを作ります。

$ rails new appname
$ cd appname
$ rails g scaffold Blog blog:string
$ rake db:migrate
$ rails server

ブラウザで http://localhost:3000/blogs を開くと簡単なアプリが動作します。

38
38
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
38
38