Skip to content

Instantly share code, notes, and snippets.

@gabigabogabu
Last active March 12, 2021 10:41
Show Gist options
  • Save gabigabogabu/2caf9a9c8eb82f3e31b369fa7649d335 to your computer and use it in GitHub Desktop.
Save gabigabogabu/2caf9a9c8eb82f3e31b369fa7649d335 to your computer and use it in GitHub Desktop.
Mac Updates keep removing git, so I made this

Mac Updates keep removing git, so I made this:

Add this to your .zprofile and it will automatically check if git is installed and ask to install it if it isn't when you start a new zsh session.

if [[ "$(git -v 2>&1)" == *"error: invalid active developer path"* ]]; then
  echo "git missing. installing Command Line Tools"
  xcode-select --install
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment