Before starting: Make sure you have the necessary folders and permissions — get more information.
Links: Homepage | Downloads
Dependencies: Autoconf | OpenSSL
Git is a distributed version control system that was initially designed and developed by Linus Torvalds for Linux kernel development.
Get the Code
/usr/local/src and download the source package.
cd /usr/local/src curl --remote-name https://mirrors.edge.kernel.org/pub/software/scm/git/git-VERSION.tar.gz
Extract the archive and move into the folder.
tar -xzvf git-VERSION.tar.gz cd git-VERSION
Compile and Install
Configure, compile and install into
make configure ./configure \ --prefix=/usr/local/mac-dev-env/git-VERSION \ --with-openssl=/usr/local/openssl make all make install
Create a symbolic link to
sudo ln -s mac-dev-env/git-VERSION /usr/local/git
Git can be compiled with the Man Pages included but it requires dependencies that can be problematic. The maintainers are aware and therefore provide a pre-compiled version available for download.
/usr/local/src and download the documentation.
cd /usr/local/src curl --remote-name https://mirrors.edge.kernel.org/pub/software/scm/git/git-manpages-VERSION.tar.gz
Extract the documentation to
tar -xzvof git-manpages-VERSION.tar.gz -C /usr/local/git/share/man
Execute the following lines to update your Bash startup script.
echo 'export PATH=/usr/local/git/bin:$PATH' >> ~/.bash_profile echo 'export MANPATH=/usr/local/git/share/man:$MANPATH' >> ~/.bash_profile
Load the new shell configurations.
Verify the Installation
Verify that you have successfully installed Git.