Mac OS X lionにgitインストール
Mac OS X lionにMacPorts使ってgitをインストール。
なんですが、僕は以前、gitをソースからコンパイルしてインストールしていたので、もうgitは使える状態でした。
ただ、MacPortsからインストールし直したかったので、既存のgitを消してMacPortsからインストールし直してみました。
もう既にgitをガンガン使っている方は、このgit入れ直しはやらない方がいいかもしれないです、自己責任でお願いします。
参考
・MacPortsでgitを入れ直す
http://kyow.cocolog-nifty.com/blog/2010/12/macportsgit-92f.html
以下手順。
まず既存のgitディレクトリをどこかへ退避します。
$ which git /usr/local/git/bin/git $ mv /usr/local/git /home/takadayuichi/work/git.old.20120909 $ git status bash: git: command not found $ which git $
これでやっと気を取り直してMacPortsからgitをインストール。
$ port search git-core git-core @1.7.11.5 (devel) A fast version control system
これですね。git-core。
$ sudo port install git-core Warning: The Command Line Tools for Xcode don't appear to be installed; most ports will likely fail to build. Warning: See http://guide.macports.org/chunked/installing.xcode.html for more information. ---> Computing dependencies for git-coreError: Unable to execute port: can't read "build.cmd": Failed to locate 'make' in path: '/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' or at its MacPorts configuration time location, did you move it?
なんかWarning出ました。
まず Command Line Tools for Xcodeをインストールしなさいよ、と言っています。
参考記事
・[Mac]Xcode+MacPortsの導入方法(SnowLeopard,Lion対応)
http://dmnlk.gehirn.co.uk/?p=139
Command Line Toolsは、xcodeのここからインストールします。
Xcode > Preferences > Downloads > Components > Command Line Tools
インストールが無事完了したら、ようやくMacPortsからgitのインストールです。
$ sudo port install git-core Password: ---> Computing dependencies for git-core ・ ・ ・ ---> Cleaning git-core ---> Updating database of binaries: 100.0% ---> Scanning binaries for linking errors: 100.0% ---> No broken files found.
[takadayuichi@takada-MacBook-Pro:~]$ git --version git version 1.7.11.5 [takadayuichi@takada-MacBook-Pro:~]$ which git /opt/local/bin/git
無事完了。