Installing Git on macOS
There are several ways to install Git on macOS. The easiest way is to install the Xcode command line tools. Since Mavericks (10.9), you can do this simply by trying to run git from the terminal for the very first time. If you don't have it installed already, it will prompt you to install it, as shown in the following image:
If you want a more up-to-date version, you can also install it via the *.dmg binary installer, downloaded from git-scm.com (it says mavericks in the file name, but just ignore that). Beware the macOS policies while installing packages downloaded from the Internet; to allow execution, you need to hold down CTRL and click on the package icon to open it:
After this, the installation will be very easy-it's just a matter of clicking on the Continue button and following the steps represented in the following screenshot:
Click on the Continue button and then go on; a window like the one shown in the following image will appear:
Click now on the Install button to start the installation. After a few seconds, the installation will be completed: