brew で git をインストールする


Git は、分散型バージョン管理システムです。

インストールしようとすると、下記のエラーが出る

$ brew install git
/usr/local/share/git-core is not writable.
Permission denied - /usr/local/lib/perl5/site_perl/5.16.2

/usr/local 配下のパーミッションを変更する

$ sudo chown -R $USER:admin /usr/local

再度、インストールすると、うまくいく。

$ brew uninstall git
==> Downloading https://homebrew.bintray.com/bottles/git-2.3.1.mavericks.bottle.
Already downloaded: /Library/Caches/Homebrew/git-2.3.1.mavericks.bottle.tar.gz
==> Pouring git-2.3.1.mavericks.bottle.tar.gz
==> Caveats
The OS X keychain credential helper has been installed to:
  /usr/local/bin/git-credential-osxkeychain

The "contrib" directory has been installed to:
  /usr/local/share/git-core/contrib

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completion has been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
  /usr/local/Cellar/git/2.3.1: 1359 files, 31M

パスとバージョンを確認する

$ which git
/usr/local/bin/git
$ git --version
git version 2.3.1

備考
いったん、git のサイト にある MAC用のパッケージをインストールしてから、
brew を試したら、いろいろエラーが出た。

==> Downloading https://homebrew.bintray.com/bottles/git-2.3.1.mavericks.bottle.
######################################################################## 100.0%
==> Pouring git-2.3.1.mavericks.bottle.tar.gz
==> Caveats
The OS X keychain credential helper has been installed to:
  /usr/local/bin/git-credential-osxkeychain

The "contrib" directory has been installed to:
  /usr/local/share/git-core/contrib

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completion has been installed to:
  /usr/local/share/zsh/site-functions
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/git-core/contrib
/usr/local/share/git-core is not writable.

You can try again using:
  brew link git
==> Summary
 /usr/local/Cellar/git/2.3.1: 1359 files, 31M

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です