This should be a simple fix. XCode can be installed from Apple’s App Store. Unreal uses this to compile games. Once installed, open Xcode and accept the licensing agreement, then re-open Unreal.
If the issue persists, please open Terminal and implement the following code:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
For any further problems, check the following threads for alternative solutions: