libgit2 is a portablepure C implementation of the Git core methods provided as a re-entrant linkable library with a solid API, allowing you to write native speed custom Git applications in any language which supports C bindings.

More Information: https://libgit2.github.com/
Steps:

  1. Launch Terminal by pressing command+space, type terminal and hit Enter key.
  2. Run
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
  3. Install
    brew install libgit2

Done!