I am very new to macOS, knowing Ubuntu a little bit, and am wondering whether git is pre-installed on macOS or not. Typing
which -a git
results in
git is /usr/bin/git
But when I init a test-repo and checkout a myBranch, the command
git branch
results in a empty line. So is there anything I do forget? I installed Homebrew before checking for git, so maybe this causes some interdependencies?
Best Answer
macOS does come with a binary at
/usr/bin/git
, however by default it's a wrapper around the command line tools installer. Running the command will print the following and return immediately.A prompt will ask the user to install the command line tools, with a button that downloads and installs the toolset.
Once installed,
/usr/bin/git
will be a proper version of Git compiled by Apple (noted by the ‘Apple Git’).If Git is installed using Homebrew, it will be at
/usr/local/bin/git
by default on Intel, at/opt/homebrew/bin/git
on ARM.