LoginSignup
17
19

More than 5 years have passed since last update.

gitを2.0.0をMACにインストールした

Last updated at Posted at 2014-05-31

はじめに

macbookのgitを2.0.0にしました。(もともとgit version 1.8.5.2 (Apple Git-48)とやらが入っていた) 一番楽そうなのがbrewだったのでそれでインストールしました。
macのバージョンは10.9です。そして普段使いはなぜかhgです。どうでもいいですね、すみません。

既存のバージョンとパスの確認

パスが通っている場所の確認とそのgitのバージョンを確認

$ which git
/usr/bin/git
$ git --version
git version 1.8.5.2 (Apple Git-48)

gitのインストール

先にも述べましたがbrewを使います。

$brew update
$brew versions git
2.0.0    git checkout e2e2236 /usr/local/Library/Formula/git.rb

brewではgitをインストールしていなかったので、

$ brew install git
$ /usr/local/bin/git --version
git version 2.0.0

でインストールできました。
すでに入っている人は $brew upgrade git で入るそうです。

パスの優先順位を変える

/etcの中に pathsというファイルが有ります。

$ cat /etc/paths
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin

となっていたのでこのままだと/usr/bin/git を使い続けてしまうので

$ cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

に書き換えます。コンソールを再起動してパスを読み直します。 ※ 全体に影響するので十分注意してください。

$ git --version
git version 2.0.0

以上で完了です。

17
19
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
17
19