Installing Git on a Mac
For a while now I've been using my Mac for development. I finally got sick of Microsoft Windows slowing down over time, needing constant TLC and making my life really difficult when it comes to configuring SSL keys. Now that I've switched, I'm never going back! I definitely won't miss DOS or Powershell, give me bash any day of the week!
Now that I have switched over there is a whole new set of problems to be over come - it is still worth it though! The first problem I came across was with git. Tried to run git but it said it needs Xcode to run, so I installed that and got Mac's version of git which is really old.
bash-3.2# git --version
git version 1.9.3 (Apple Git-50)
but latest version is 2.2.1
bash-3.2# cd /usr/bin
bash-3.2# ls -l git*
-rwxr-xr-x 1 root wheel 14160 29 Sep 06:38 git
-rwxr-xr-x 1 root wheel 14176 29 Sep 06:38 git-cvsserver
-rwxr-xr-x 1 root wheel 14192 29 Sep 06:38 git-receive-pack
-rwxr-xr-x 1 root wheel 14160 29 Sep 06:38 git-shell
-rwxr-xr-x 1 root wheel 14192 29 Sep 06:38 git-upload-archive
-rwxr-xr-x 1 root wheel 14192 29 Sep 06:38 git-upload-pack
Installed from http://git-scm.com/download/mac which installed into /usr/local/git
.
So to redirect old git to new git, you need root:
cd /usr/bin
sudo mv git git.xcode
sudo mv git-cvsserver git-cvsserver.xcode
sudo mv git-receive-pack git-receive-pack.xcode
sudo mv git-shell git-shell.xcode
sudo mv git-upload-archive git-upload-archive.xcode
sudo mv git-upload-pack git-upload-pack.xcode
GITBIN=/usr/local/git/bin
sudo ln -s $GITBIN/git
sudo ln -s $GITBIN/git-cvsserver
sudo ln -s $GITBIN/git-receive-pack
sudo ln -s $GITBIN/git-shell
sudo ln -s $GITBIN/git-upload-archive
sudo ln -s $GITBIN/git-upload-pack
cd /usr/bin
macbookpro:bin mrn$ ls -l git*
lrwxr-xr-x 1 root wheel 22 13 Feb 13:05 git -> /usr/local/git/bin/git
lrwxr-xr-x 1 root wheel 32 13 Feb 13:06 git-cvsserver -> /usr/local/git/bin/git-cvsserver
-rwxr-xr-x 1 root wheel 14176 29 Sep 06:38 git-cvsserver.xcode
lrwxr-xr-x 1 root wheel 35 13 Feb 13:06 git-receive-pack -> /usr/local/git/bin/git-receive-pack
-rwxr-xr-x 1 root wheel 14192 29 Sep 06:38 git-receive-pack.xcode
lrwxr-xr-x 1 root wheel 28 13 Feb 13:06 git-shell -> /usr/local/git/bin/git-shell
-rwxr-xr-x 1 root wheel 14160 29 Sep 06:38 git-shell.xcode
lrwxr-xr-x 1 root wheel 37 13 Feb 13:06 git-upload-archive -> /usr/local/git/bin/git-upload-archive
-rwxr-xr-x 1 root wheel 14192 29 Sep 06:38 git-upload-archive.xcode
lrwxr-xr-x 1 root wheel 34 13 Feb 13:06 git-upload-pack -> /usr/local/git/bin/git-upload-pack
-rwxr-xr-x 1 root wheel 14192 29 Sep 06:38 git-upload-pack.xcode
-rwxr-xr-x 1 root wheel 14160 29 Sep 06:38 git.xcode
macbookpro:~ mrn$ git --version
git version 2.2.1
Wrote this article a while ago before I knew about .extlink Brew. Now I use Brew to install pretty much everything GNU and open source related.
No feedback yet
Form is loading...