skip to Main Content

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.

2

Answers


  1. 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/

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search