Yes, recently I used the following command to use xcode_16.2.app for one of my projects.
export DEVELOPER_DIR=/Applications/Xcode_$XCODE_VERSION.app/Contents/Developer
This one no need to use any password as I was using this in my CI machine.
Happy coding (º_º)