LoginSignup
0
2

More than 5 years have passed since last update.

Homebrewで最新のRubyとgitを導入

Posted at

標準搭載されてるRubyとGitを,homebrew使って最新版にした時のメモ
Rubyのバージョン切り替えができるものもあるけど,最新版しか使わないからスルー

動作環境

  • MacOS X El Capitan
  • homebrew導入済
  • ruby 2.0.0p648 (2015-12-16 revision 53162) ←Apple標準搭載
  • git version 2.10.1 (Apple Git-78) ←Apple標準搭載

(参考)以下をターミナルで入力してenterすると,バージョンが確認出来る
$は入力不要

$ ruby -v
$ git --version

インストール

$ brew install ruby
$ brew install git

上のコマンドを実行しただけだと,まだバージョンは変わらなかった

パスの設定ファイルを編集

rubyを呼んだら,今homebrewで導入したrubyが呼び出されるようにする(gitも同じ)
本当は,homebrewを導入した時点でするべきだったらしい

以下のコマンドを実行して,パスの設定ファイルを編集できるようにする

$ emacs ~/.bash_profile

emacsエディタが開くので,一番最初に以下を書き加える

export PATH="/usr/local/bin:${PATH}"

そしてファイルを保存
(「ctrl」押しながら,「x」「c」の順に押す.保存するか聞かれるから「y」を入力)

その後,
以下のコマンドを実行して,設定ファイル(~/.bash_profile)の内容を反映させる

$ source ~/.bash_profile

最新版に更新できたか確認

$ ruby -v
ruby 2.4.0p0 (2016-12-24 revision 57164)

$ git --version
git version 2.11.1

参考

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