A lot of problems on my Mac after my recent upgrade were solved with xcodebuild -runFirstLaunch and xcode-select -switch /Library/Developer/CommandLineTools. This kind of stuff on macOS is just not a good experience.