15

I've been using windows for software development. I'm not aware of MacOS internals. I'm aware that Xcode software is used to develop iOS/Mac apps but I don't need it.

For my usecase, I was able to install intellij, Java, Docker, Minikube & Visual-Studio-Code on my Intel Mac with BigSur... I'm able to run simple micro-service with working DB in local in docker container.

But when I try to use Git I'm getting this issue: xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

I think this is related to Xcode. I didn't want to touch it,
so I tried to install Git by brew.

brew install git but got error Error: git 2.29.2 is already installed

So I tried to do update brew upgrade git but again got the below error again.

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

I also tried to remove Git to do a clean install brew remove git and there was no error, but then I installed git with brew again and the same error.

Is there a way to install Git without having Xcode ? I dont want to install unnecessary software on my machine, things which I don't need.

initall
  • 2,385
  • 19
  • 27
ThrowableException
  • 1,168
  • 1
  • 8
  • 29
  • This one maybe: https://sourceforge.net/projects/git-osx-installer/ Found at https://git-scm.com/download/mac – phd Jan 09 '21 at 14:20
  • tried, didn't work.... Had to install xCode command line... not sure about repercussions at this time.. but working for now... – ThrowableException Jan 09 '21 at 14:23

2 Answers2

15

Note that this is a plain copy of a previous answer of mine on superuser.com.

Here's a way to install git on Mac OS X without XCode.

Git's official web site provides an installer : http://git-scm.com/download/mac

After installing git, you also have to add its directory to your path :

echo "PATH=/usr/local/git/bin:\$PATH" >> ~/.bash_profile
source ~/.bash_profile

Adding the directory to the path will prevent Mac OS X from aksing you to install XCode each time you type git in the terminal.

Credits goes to Bobby Allen and to GoZoner's answer on SO.

Daishi
  • 12,681
  • 1
  • 19
  • 22
5

What you need is not xcode but xcode command line tool which has a small download and running file space compared to xcode of 11GB download space and running space of 31GB

You can download it from apple at https://developer.apple.com/downloads/

classic-code
  • 136
  • 1
  • 3
  • 1
    git on Mac OSX (mine is Monterey 12.5.1) is asking to re-agree to the XCode license agreement, but there's no way to agree. The ask for license is broken it seems and now I cannot use git without agreeing to an 11 page license agreement for all of xcode. – Piyush Mehta Sep 14 '22 at 23:27