Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialgbp
5,619 PointsHow to install Git on Mac OS X
Hello. Mac running OS X 10.7.5 and Git is not installed in my machine, presumably. In Terminal, git -v yields "-bash: git: command not found". Can't proceed with Installing a Ruby Development Environment module until I have Git installed. Where can I grab this download? Thank you for your input. Also, after installing, anything else I need to run to get it up and running? Thanks again.
3 Answers
Ben Griffith
5,808 PointsWhile not needed to install Git (you could get it from the link Ryan supplied), I'd advise you to check out homebrew, http://brew.sh - a package manager for OS X. With homebrew installed you can easily install git and keep it up to date.
If you do decide to use brew - after installing, open up a terminal and run;
brew install git
And that should sort you out with the latest stable version.
Ryan Farber
5,329 Pointshttp://git-scm.com/
Should be able to get everything you need
https://mac.github.com/ For when you want to show employers your source code and projects on your resume
Let me know if it solves your problem
gbp
5,619 PointsThanks, Ryan and Ben. Ryan, I downloaded from your link and hopefully this will get me moving forward. After installing, I went to Terminal and ran git -v but now getting "Illegal instruction: 4". What is the meaning of this? Maybe it has something to do with my Mac being on an older version of OS X? 10.7.5 to be specific. Anyway, I'll see if I can proceed downloading the Ruby dev env.
Ryan Farber
5,329 PointsThat's exactly what it is. I've manage to find this for Illegal instruction 4
gbp
5,619 PointsThanks, Ryan. Visited the stackoverflow link and how do I make "-mmacosx-version-min=10.5" work for me? I am sorry but I am not at all well-versed with interacting with the console. Thank you for guiding me.
Ryan Farber
5,329 PointsTry typing that into the terminal first and let me know what comes up. You might need to try and download an earlier version of git if your computer is on an older version
gbp
5,619 PointsGetting "command not found"
Ryan Farber
5,329 PointsHmm, this is getting beyond my ability to solve it. I'm not sure on exactly what to do next. Sorry that I couldn't be more help. I would just try to find documentation on the issue for git and mac from this point on.
gbp
5,619 PointsRyan, thanks for all your help and no worries. Installing git via brew succeeded. Read further above for the reasons the installs were failing. Probably for the same reasons your suggestion earlier failed as well. But brew gave lots of useful guidance to resolve. Otherwise I would have never known what to do.
Ryan Farber
5,329 PointsRyan Farber
5,329 PointsThat's an awesome link. I'll keep this mind when I start to learn the Mac OS in more detail.
gbp
5,619 Pointsgbp
5,619 PointsHi Ben, do you know if this is compatible with OS X 10.7.5? First, I am going to uninstall the git version I downloaded earlier (from the link Ryan provided). Before I install homebrew, however, please let me know about the compatibility. Thank you.
gbp
5,619 Pointsgbp
5,619 PointsThe brew install succeeded but the git install failed. Looks like I have to first update Xcode to 4.6.3, according to brew doctor. So I am doing that at the moment. Fingers crossed.
gbp
5,619 Pointsgbp
5,619 PointsNo luck installing git, unfortunately. brew update reveals it is up to date. And brew doctor is issuing no warnings. May have to reinstall Xcode?
gbp
5,619 Pointsgbp
5,619 PointsReporting success installing git via brew. I needed to install the Xcode Command Line Tools. Once installed, "brew install git" ran through without issues. Version is 1.7.12.4 Thank you, Ben.
Ben Griffith
5,808 PointsBen Griffith
5,808 PointsHey gbp sorry for the late reply! Different time zones! Hope you got on ok. One thing to note is that after you've installed Xcode Command Line Tools I have a feeling you need to run Xcode and accept the Terms and Conditions that pop up in order to stop the possibility of further problems down the road that are to do with permissions. Hope you managed to get it sorted!
gbp
5,619 Pointsgbp
5,619 PointsHello Ben, thank you. Got on ok. Brew doctor was graceful in guiding me and indeed suggested that I accept the Xcode terms & conditions which I did promptly. Thanks again for your guidance.
alexandermuhr
3,466 Pointsalexandermuhr
3,466 PointsHi Ben,
I know this might be repetitive, but I am having a problem updating git on my computer.
I'm running OSX 10.7.5 - while I downloaded homebrew and am pretty sure it's working correctly because I've tried downloading the latest git via "brew install git" it says I downloaded it already.
I believe that my problem is that when I run "which git" I still get: /usr/bin/git
When it's actually supposed to be: /usr/local/bin/git
It's my understanding that if you run: export PATH=/usr/local/bin:$PATH that should fix things but what happens then is the updated git is installed at: /usr/local/bin/local/bin/git
Then when I run: git --version I get an error... so I found out how to delete it.
Maybe it has to do with my .bash_profile? export PATH=/usr/local/git/bin:/usr/local/bin:/usr/local/sbin:/usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin export PATH=/usr/local/git/bin:/usr/local/bin:/usr/local/sbin:/usr/local/git/bin:/usr/local/bin:/usr/local/sbin:/usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin
Any help on this? I have been working hours on it.
Thanks, Alex