Join Ray Villalobos for an in-depth discussion in this video Installing Git on a Mac, part of Up and Running with Git and GitHub.
- In this video, I'll show you how to install Git on a Mac. If you wanna learn how to install Git on a PC, check out the next video. Installing things is pretty easy, all you have to do is go to the Git website, which is at git-scm.com, and then click on this Downloads for Mac button, and your download should automatically start, however, sometimes this doesn't quite work, so you have to click here to download manually, and then you have to wait five seconds, and you should see this installer package downloading.
You can also click on this direct link right here, which will download it a little bit faster. Once the package finishes downloading, you can go to your downloads folder, or you can just click on this button right here, I'm using Google Chrome, and this will open up the DMG document, and you should see something like this that has the package, as well as a README text file and some other little files. If you've never installed Git before, you can double click on this package. You might get a message like this that says this package cannot be opened because it's from an unidentified developer, if you get that, just click OK, go to the apple menu and select System Preferences.
And then, click on Security & Privacy, and then find this Open Anyway button, you can click on that, or if you want to, you can modify your preferences here. Click on this lock, then you can click on anywhere, then you won't see that message again. And, I'll hit Open Anyway, and just go through the install prompts. You may need to type in your password here. Just go ahead and close this. Now, if we wanna make sure that Git has installed, we need to go to our terminal application, and type in terminal, and in here, we can type in git --version to see what version of Git we're using.
So, notice that I'm using Git version 2.4.0, that's the version that I downloaded. If you see something else here, there's some additional things that you may need to do. If you open up this README file, it tells you all about them, so for example, you can use this command right here. Some of the version that come with the Mac OS are almost impossible to uninstall, so let me actually go ahead and open this up, so that I can copy that command. And, you could do this command, and I'll type in my password here.
Now, it says No such file or directory because I've already deleted that file, but if you run that command and it tells you something, it means that you're ready for the next step which is uninstalling your version of Git. So, you can drag this uninstall.sh bash file right here and hit return, it says that it's gonna uninstall Git, so we'll go ahead and hit yes, and it's gonna get rid of Git, let's go ahead and clear this out. Which means that we have to install it again, so we just go through the same process.
Go to the apple menu, and security, say Open Anyway, close this out, and just go through these prompts again. And, once you're done with all that, you should be able to see the version of Git that you installed when you do git --version. And, that's all there is to it.
Want to explore Git and GitHub in more depth? Watch Git Essential Training for more comprehensive coverage of these tools.