Hey there @whenisgamora! Welcome to the community! So this mostly depends on what version of Xcode is the latest your Mac can install. I believe the lowest you can go is Monterey 1 version lower than yours so you may be clear, and it requires Xcode 14.1 or better.
The following software versions are compatible with the current version of Unreal Engine: