How To Install Git on MAC OS and Linux

You can’t use Git until you make it available on your computer. There are a couple different ways you can install Git and make it available for use. The option you choose will depend on the system you are running.

In this article, I will show you how to install Git on a MAC OS, as well as how to install Git on LINUX.

A couple of things you will want to make note of while interacting with Git.

  1. Even if you already have Git installed it is a good idea to update to the latest version.
  2. All of the commands below should work, even on the older versions of Git. They may act a little differently but should work. Git is very good at preserving backward compatibility. Any version after 2.0 should work just fine.

How To Install Git on MAC OS

There are a couple of ways to install Git on MAC OS. The easiest way to do it would probably be to install the Xcode Command Line Tools. This will work on Mavericks (10.9) or above, so it should cover you. If you are running on OS older than that I would recommend you look into upgrading that first.

If your MAC OS is good to go simply run git from the Terminal the very first time. Here is what that would look like:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]$ git –version [/ht_message]

If it isn’t installed you will be prompted to install. If it is installed, then the above command should output the current version installed.

If you need or want a more up-to-date version, then you can install Git on MAC OS via a binary installer. There is a MAC OS Git installer that is maintained and made available for download on the Git website, at https://git-scm.com/download/mac.

Finally, a third option of installing Git on MAC OS is to install it as part of the GitHub for MAC install.

They have a GUI Git tool that has an option to install command line tools as well. You can download this tool from the GitHub for MAC website, at https://mac.github.com.

How To Install Git on Linux

More often than not you can install Git on Linux via a binary installer through the package management tool that comes with your distribution.

If you’re on Fedora or other closely related RPM-based distribution, like RHEL or CentOS, you can use dnf:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]$ sudo dnf install git-all[/ht_message]

If you happen to be on a Debian-based distribution, like Ubuntu, try using apt:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]$ sudo apt install git-all[/ht_message]

Installation For Other Unix Distributions

Gentoo

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]# emerge –ask –verbose dev-vcs/git[/ht_message]

Arch Linux

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]# pacman -S git[/ht_message]

openSUSE

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]# zypper install git[/ht_message]

Mageia

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]# urpmi git[/ht_message]

Nix/NixOS

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]# nix-env -i git[/ht_message]

FreeBSD

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]# pkg install git[/ht_message]

Solaris 9/10/11 (OpenCSW)

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]# pkgutil -i git[/ht_message]

Solaris 11 Express

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]# pkg install developer/versioning/git[/ht_message]

OpenBSD

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]# pkg_add git[/ht_message]

Alpine

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]$ apk add git[/ht_message]

Slitaz

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]$ tazpkg get-install git[/ht_message]

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.