Xcode not found

Trying to open Unreal 5.4 on M1 Mac OS Sonoma 14.6.1. Warning message received below:

Xcode Not Found

Unreal Engine requires Xcode to compile shaders for Metal. Install Xcode and open it to accept the license agreement. If you install Xcode to any location other than Applications/Xcode, also run the Xcode-select command line tool to specify its location.

Please provide detailed instructions to help me troubleshoot this issue.
Thank you

You need to download and install Xcode from apple store: ‎Xcode on the Mac App Store

Then open Xcode and accept it License.

And finally run a Terminal and exec:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Xcode can be downloaded via Mac App Store. It solves this problem.
Thank you!