Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Created March 15, 2012 04:06
Show Gist options
  • Select an option

  • Save RichardBronosky/2041806 to your computer and use it in GitHub Desktop.

Select an option

Save RichardBronosky/2041806 to your computer and use it in GitHub Desktop.
A script to generate a spreadsheet of the iOS device UDIDs connected to your developer account
#!/usr/bin/env bash
# A script to generate a spreadsheet of the iOS device UDIDs connected to your developer account
# Copy the Apple Developer Portal cookies with the "cookie.txt export" Chrome plugin, then...
# pbpaste > cookies.txt
# ...then run this script
# The index page has a list of truncated UDIDs with link to a detail page for each.
curl --cookie cookies.txt https://developer.apple.com/ios/manage/devices/index.action | \
# Strip the html down to just a list of links.
sed '/>Details<\/a>/!d; s?.*href="?https://developer.apple.com?; s/".*//;' | \
# Read each of the links into the REPLY variable
while read; do
# Retrieve each of the detail pages
curl --cookie cookies.txt $REPLY | \
# Mutate the HTML output into a single tab delimited line
sed -E '/name="desc"|Device UDID/!d; s/.*value="//; s/".*//; N; s/\n//; s/(.)..Device UDID: /\1/;'
# Input redirect the URLs list into the read loop
#done < details.lst | \
done | \
# Add line numbers (BSD sed will not translate \t to a tab)
sed = | sed -E "N; s/\n/.$(echo -ne '\t')/;" > devices.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment