Use terminal "system_profiler" to find the UDID for attached devices
If you're comfortable using Terminal, you can paste this command in to Terminal or save it as a script or alias.
system_profiler SPUSBDataType -detailLevel mini | \
grep -e iPhone -e Serial | \
sed -En 'N;s/iPhone/&/p'
Paste that text into Terminal and press enter to run system_profiler for the USB devices, and then filter for only the iPhone's UDID from the pretty-long output. Again, be sure to add the necessary hyphen after the first eight digits for iPhone XS and XS Max devices.
output on terminal:
$ system_profiler SPUSBDataType -detailLevel mini | \
grep -e iPhone -e Serial | \
sed -En 'N;s/iPhone/&/p'
Output:
2018-10-25 12:57:06.527 system_profiler[23461:6234239] SPUSBDevice:
IOCreatePlugInInterfaceForService failed 0xe0003a3e
iPhone:
Serial Number: 3aeac....4145
Ignore following failures
2018-10-25 12:57:06.527 system_profiler[23461:65234239] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe0003a3e
Look for Serial Number: 3aeac........4145
Alias:
# find UDID
alias fudid="system_profiler SPUSBDataType -detailLevel mini | grep -e iPhone -e Serial | sed -En 'N;s/iPhone/&/p'"
From: https://deciphertools.com/blog/2014_11_19_how_to_find_your_iphone_udid/