Skip to content

Instantly share code, notes, and snippets.

@jonathanpenn
Created May 15, 2012 03:37
Show Gist options
  • Save jonathanpenn/2698887 to your computer and use it in GitHub Desktop.
Save jonathanpenn/2698887 to your computer and use it in GitHub Desktop.
Ruby script that fetches the UUID of the first iOS device plugged into your machine
#!/usr/bin/env ruby
ioreg = `ioreg -w 0 -rc IOUSBDevice -k SupportsIPhoneOS`
device_uuid = ioreg[/"USB Serial Number" = "([0-9a-z]+)"/] && $1
if device_uuid
puts device_uuid
else
puts "No device detected."
exit 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment