Skip to content

Instantly share code, notes, and snippets.

@j796160836
Forked from tehnoir/getudid.sh
Created December 17, 2016 13:36
Show Gist options
  • Save j796160836/fdcb6d10685cb823938273bd6c56b0a8 to your computer and use it in GitHub Desktop.
Save j796160836/fdcb6d10685cb823938273bd6c56b0a8 to your computer and use it in GitHub Desktop.
getudid
#!/bin/bash
function getUDID {
udid=($(system_profiler SPUSBDataType | grep -A 11 -w "iPad\|iPhone\|iPad" | grep "Serial Number" | awk '{ print $3 }'))
if [ -z $udid ]; then
echo "No device detected. Please ensure an iOS device is plugged in."
exit 1
else
for i in "${udid[@]}"; do
echo -n $i | pbcopy
echo "UDID: $i"
done
fi
}
getUDID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment