This article was originally published on Medium on March 11, 2023.

Are you in need of your iPhones Unique Device Identifier(UDID) and don’t have iTunes? Maybe you’re like me and just do not want to navigate a GUI of any sort, ever. If you’re on macOS, I have a quick way of obtaining this value quickly with only a few steps using the macOS Terminal.
Step 1. Plug your iPhone to your Macbook
For this all to work, the iPhone needs to be plugged into your Macbook via USB.
Step 2. Open the Terminal App
Either go to your Applications folder within Finder and locate the Terminal application or do what I do and open Spotlight (via ⌘ + Space) and type Terminal and press return.
Step 3. Execute system_profiler
Below we are using the system_profiler command along with the argument SPUSBDataType. This allows us to only output the USB related information for our Macbook. This output is then piped into grep. We are looking to match on the string ‘iPhone’. After the match, we instruct it to also include the next 12 lines so we have all of the iPhone information. This output is again piped to grep for further parsing. The final part of this pipeline we are wanting to match on ‘Serial Number’. The output from this search will be the UDID.
system_profiler SPUSBDataType | grep 'iPhone' -A 12 | grep 'Serial Number'
If all goes well, you will see something similar to the following:
Serial Number: 0000123000045ABC1234567D
Note: You may see additional messaging from the system_profiler and failures. These messages can be ignored as we only care about the serial number.
If your serial number (a.k.a UDID) is not returned. Try unplugging your iPhone and plugging it back in. At the time of this writing, I am not certain if your have to have to tap Trust Device on your iPhone for this information to be available to system_profiler.
Wham. Bam. Thank you system_profiler!
Well… it doesn’t rhyme but was it helpful? If so give me a clap! This is yet another instance where a little bit of exploring on my end has showed me how to access system information via the macOS Terminal. This additional building block of knowledge will allow me to continue streamlining my workflow in the future. Saving me time by not having to open bloated software nor click through a clunky GUI (Graphical User Interface) to obtain a small amount of information.
If you found this helpful and love learning about low-friction solutions to your problems, please follow me. I am always finding simpler ways of solving problems I experience myself and sharing it with the world so that together we continue on the path to native productivity.
Until next time, happy hacking!
