Git Bash For Mac Sierra

# on the built-in bash on macos use source /.bashprofile # if using bash through homebrew over ssh use source /.bashrc # and if using zsh source /.zshrc Step 6: Create your GPG Key Run the following command to generate your key, note we have to use the -expert flag so as to generate a 4096-bit key. I just used this Git installer to install Git on my iMac, which is running Mac OS X 10.6. The installer crashed the first time I tried to run it, but then I tried a second time, and it worked fine. The README file that comes with the installer said that you can optionally run a shell script to get Git to work with GUI tools, and I did that as well.

The shell path for a user in macOS or OSX is a set of locations in the filing system whereby the user has permissions to use certain applications, commands and programs without the need to specify the full path to that command or program in the Terminal. This will work in macOS Mojave, Sierra and all older OSX operating systems; El Capitan, Yosemite, Mavericks and Lion.

So instead of running something like this, with a path to the command:

You can just type the command, regardless of where you are in the filing system:

Your shell path is a bunch of absolute paths of the filing system separated by colons :

You can find out whats in your path by launching Terminal in Applications/Utilities and entering:

And the result should be like this…

So this is stating that you can run Unix style applications or commands located in 5 default locations of a certain path in the filing system:

  • /usr/bin
  • /bin
  • /usr/sbin
  • /sbin
  • /usr/local/bin

These directories are not visible by default in the filing system but you can make them visible.

Adding a Temporary Location

You can add extra locations to your path, in the mysql example above it’s location /usr/local/mysql/bin which is not in the default path, you can add it in Terminal like so:

So here I have copied my existing path and added the new location on the end. Test it by running echo $PATH again in the Terminal.

One of the disadvantages of this is that the new location will only be honored for that particular Terminal session, when a new Terminal window is launched it will have the original default path again.

Adding in a Permanent Location

To make the new pathstick permanently you need to create a .bash_profile file in your home directory and set the path there. This file control various Terminal environment preferences including the path.

Move into home directory

Create the .bash_profile file with a command line editor called nano

Add in the above line which declares the new location /usr/local/mysql/bin as well as the original path declared as $PATH.

Git Bash

Save the file in nano by clicking ‘control’ +’o’ and confirming the name of the file is .bash_profile by hitting return. And the ‘control’+’x’ to exit nano

Git bash for mac sierra mac

So now when the Terminal is relaunched or a new window made and you check the the path by

Git Bash For Mac Sierra

You will get the new path at the front followed by the default path locations, all the time

Rearranging the default $PATH

If you needed to rearrange the paths in the default $PATH variable, you can just do that and leave off $PATH.

So lets say you want /use/local/bin at the beginning to take precedence you can add the default path like so inside .bash_profile

And then you can slot in other paths as required.

Install Git on macOS Mojave, Sierra, or an older Mac OSX version by getting the latest git version from the Git home pageor from the direct macOS latest link.

This will download the latest version of Git to your desktop/download area as a dmg file, (it says mavericks in the file name but just ignore that)

Open the dmg file, then Control/Right Click the git.pkg file to install.

When Git is installed check in the Terminal, launch the Terminal from /Applications/Utilities and check the version:

And the version is displayed

To see where it is located

Mac Update Git

And the location is shown

Upgrading Git from a previous version to the latest

If you have previously installed Git you can upgrade to the latest version by uninstalling the previous install by using the uninstall.sh script…

Go through the same process of downloading and mounting the latest git .dmg.

Your previous Git configuration settings and working repositories remain intact.

Trumping Xcodes Older Git

Git Bash For Mac Sierra Download

If you have Xcode already installed and have installed command line tools then you already have Git, probably an older version which is distributed with Xcode, this is installed in a path that takes precedence at:

The Mojave version is:

To run the latest version you need to adjust your shell path so that /usr/bin/git runs after /usr/local/bin

You need to adjustshell path , the path will be set in either .bashrc or .bash_profile in your home directory, more likely .bash_profile

So add into the path similar to the below and keep what you already have in the path, each segment is separated by a colon:

Restart or reload the Terminal and the newer Git version will now be used.

Install Git Bash Windows 10

Learn how to set up a Git workflow with your local OSX client and a remote webserver.

Install Git Bash On Mac

Using Git