Xcode Error message

I downloaded Unreal Engine 5.2, upon launching, I receive this error message:

“Can’t find Xcode install for Metal compiler. Please install Xcode and run Xcode.app to accept license or ensure active developer directory is set to current Xcode installation using xcode-select”

I downloaded XcodeI run it after accepting the terms and I still get the same error message when launching Unreal Engine. Please help