I’ve updated to macOS Big Sur recently. When I tried to init a new Git repository today I was greeted with this error:

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

Invalid Active Developer Path

Luckily this is an easy fix. Go to your terminal and enter xcode-select --install.

% xcode-select --install
xcode-select: note: install requested for command line developer tools

Confirm the following popups and once done, dev tools are back!

% git init
Initialized empty Git repository in /Users/dan852/dev/.git/

Update via Apple Developers download

Should the above approach fail for whatever reason log in to or sign up for Apple Developer. In the list of downloads look for Command Line Tools for Xcode xx.x.

Download and install the dmg and you are good to go.

Note: This step is necessary for any (semi-)major update of macOS!