-2

While downloading RStudio, I accidentally agreed to download Git too (macOS Sonoma 14.4.1). Its location via the terminal:

which git
/usr/bin/git
git --version
git version 2.39.3 (Apple Git-146)

I am not sure how much it is actually needed for my work with R and want to remove it for security reasons.

I tried deleting git using rm -rf (as discussed here in a YouTube video):

rm -rf .git
rm-rf.usr/bin/git
no such file or directory: rm-rf.usr/bin/git
rm -rf ~/usr/bin/git
rm -rf /usr/bin/git
rm: /usr/bin/git: Operation not permitted
rm-rf.Apple Git-146
command not found: rm-rf.Apple

and by using uninstall.sh as discussed here but it all ends with "no such file or directory: ...":

uninstall.sh
command not found: uninstall.sh
/usr/bin/git/uninstall.sh
not a directory: /usr/bin/git/uninstall.sh

Are there any possibilities to delete Git without installing homebrew? Apologies if the description is unclear or the solution is simple, I am new to the topic and it is surely not simple to me. Your time and response are much appreciated!

Giacomo1968
  • 58,727
Gil
  • 1

1 Answers1

-1

git is shipped with macOS! The git at /usr/bin/git is actually just a wrapper which calls the git in your XCode sdk or XCode command line tools. So simply uninstall XCode command line tools or XCode itself if you have it and it should be gone.

To uninstall Xcode command line tools simply run sudo rm -rf /Library/Developer/CommandLineTools which will delete it. For Xcode simply just do the classic drag into the bin.

Please take this as a warning to NEVER manually delete system files unless you know exactly what will happen.