Install Git on Mac

  • Post author:
  • Post category:Git
  • Post comments:0 Comments
Install Git on Mac

There are multiple ways to install Git on mac. It comes inbuilt with Xcode or its other command-line tools. To start the Git, open the terminal and enter the below command:

$ git --version  

The above command will display the installed version of Git.

Output:

git version 2.24.0 (Apple Git-66)

If you do not have installed it already, then it will ask you to install it.

Apple provides support for Git, but it lags by several major versions. We may install a newer version of Git using one of the following methods:

Git Installer for Mac

This process is the simplest way to download the latest version of Git. Visit the official page of git downloads. Choose the download option for Mac OS X.

The installer file will download to your system. Follow the prompts, choose the required installer option. After the installation process is completed, verify the installation was successful by running the below command on the terminal:

$ git --version  

The above command will display the installed version of Git. Consider the below output.

Output:

git version 2.24.0 (Apple Git-66)

Now, we have successfully installed the latest version on our mac OS. It’s time to configure the version control system for the first use.

To register a username, run the below command:

$ git config --global user.name "Adglob"  

To register an email address for the given author, run the below command:

$ git config --global user.email "Adglob.in" 

To go in-depth with the git config command, visit Here.

Installation via MacPorts

Sometimes MacPorts also referred to DarwinPorts. It makes the straightforward installation of software on the Mac OS and Darwin operating systems. If we have installed MacPorts for managing packages on OS X, follow the below steps to install Git.

Step1: Update MacPorts

To update MacPorts, run the below command:

$ sudo port selfupdate  

Step2: Search for the latest Ports

To search for the most recent available Git ports and variants, run the below command:

$ port search git  
$ port variants git  

The above command will search for the latest available port and options and will install it.

Step3: Install Git

To install Git, run the below command:

$ sudo port install git  

We can also install some extra tools with Git. These tools may assist Git in different manners. To Install Git with bash-completion, svn, and the docs, run the below command:

$ sudo port install git +svn +doc +bash_completion +gitweb  

Now, we have successfully installed Git with the help of MacPorts on our system.

Step4: Configure Git

The next step for the first use is git configuration.

We will configure the Git username and email address as same as given above.

To register a username, run the below command:

$ git config --global user.name "Adglob"  

To register an email address for the given author, run the below command:

$ git config --global user.email "Adglob.in"  

Install Git via Homebrew

Homebrew is used to make the software installation straightforward. If we have installed Homebrew for managing packages on OS X, follow the below steps to go with Git:

Step1: install Git

Open the terminal and run the below command to install Git using Homebrew:

$ brew install git  

The above command will install Git on our machine. The next step is to verify the installation.

Step2: Verify the installation

It is essential to ensure that whether the installation process has been succeeded or not.

To verify whether the installation has been successful or not, run the below command:

$ git --version  

The above command will display the version that has been installed on your system. Consider the below output:

git version 2.24.0

Step3: Configure Git

We will configure the Git username and email address the same as given above.

To register a username, run the below command:

$ git config --global user.name "adglob"  

To register an email address for the given author, run the below command:

$ git config --global user.email "Adglob.in"  

Next Topic: Click Here

Leave a Reply