LoginSignup
1
0

More than 3 years have passed since last update.

Ruby環境構築【Mac】

Last updated at Posted at 2019-10-22

Rubyの環境構築方法を記載します。

【単語】

●Ruby
オブジェクト指向のインタプリタ言語
Rubyコミュニティサイト

●Xcode
MacOSのIDE
今回は後述のCommand Line Toolsのために用意
App Store

●Command Line Tooles
コマンドを入力して操作するアプリケーション

●Homebrew
macOS用パッケージマネージャー
Homebrewに関しての参考Qiita記事

●rbenv
Rubyのバージョン管理ツール
rbenvに関しての参考Qiita記事

【確認】

MacOSでは、Rubyは既にインストールされています。
既にインストールされているRubyのバージョンを確認しましょう。

ruby -v

確認したら、環境構築に入りましょう。

【構築手順】

*入力は全てターミナルで行います。

●Xcode,Command Line Tools
1:App Storeからインストール
2:Xcodeインストール後、起動し、認証させる。
3:Command Line Toolesをインストールする

xcode-select --install

●Homebrew
1:Homebrewをインストール

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

2:Homebrewを最新状態にアップデートする

brew update

3:Homebrewの問題がないかを確認する

brew doctor

●rbenv
1:rbenvをインストール
⇨インストール途中で、Enterボタン入力、ログインパスワード入力を求められます。

brew install rbenv

2:rbenvの設定を行う

echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bash_profile

●Rubyバージョン管理
1:rbenvで管理できるRubyの一覧を表示する

rbenv install —list

2:Ruby2.5.0ダウンロード

rbenv install 2.5.0

3:Ruby2.5.0に切り替える

rbenv global 2.5.0

以上の操作で、MacOS環境でRubyの環境構築を行います。

1
0
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
1
0