Help us understand the problem. What is going on with this article?

MacOSX Sierra でRubyonRailsの開発環境を構築する

More than 1 year has passed since last update.

もともとvagrant上で開発していましたが、ポート関連とかWebSocketとか諸々問題が発生することが多く、快適に開発できないのでMac自体に環境を構築することにしました。

Homebrewのインストール

本体のインストール

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bash_profile
$ source ~/.bash_profile

インストール確認

$ brew doctor
Your system is ready to brew.

最新パッケージへの更新

$ brew update
Already up-to-date.

Rubyのインストール

rbenvのインストール

$ brew install ruby-build
$ brew install rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile

rubyのインストール

2.3系の最新を入れることにしました。

$ rbenv install -l
$ rbenv install 2.3.4
$ rbenv global 2.3.4
$ rbenv version
2.3.4 (set by /Users/ryo/.rbenv/version)
$ ruby -v
ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-darwin16]

Railsのインストール

$ gem install rails
$ gem install bundler
$ rbenv rehash
$ source ~/.bash_profile
$ rails -v
Rails 5.0.2

railsサンプルアプリを動かしてみる。
各プロジェクト用ディレクトリとして私はホームディレクトリ配下にwebappディレクトリを作成しています。

$ mkdir webapp
$ cd webapp
$ rails new sample
$ cd sample/
$ rails g scaffold Name name:string
$ rake db:migrate
$ rails server

http://localhost:3000/names
にアクセス

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした