Query Apple's Servers for Update Using Script?

Is it possible to have a script or some sort of command-line tool that will query Apple's update servers to see what the latest version of an OS is? For example, I'd like to alert somewhere when a new iOS version is released without me having to check tech news websites or directly on my iPhone, that all seems too reactive.

Perhaps something like this already exists? Perhaps I just need to better understand how devices talk to Apple to know if they have an update available to them?

Thank you in advance for your help.


Apple has pages up beneath https://support.apple.com/en_US/downloads/ios for each major iOS release. Looking at About iOS 13 Updates one can see an overview of all available iOS13 versions.

enter image description here

In the HTML source this is coded as

<p><a href="#1341"><img alt="" src="/library/content/dam/edam/applecare/images/en_US/il/spacer.png" width="76">iOS 13.4.1<br>
 &nbsp;&nbsp;</a>
<p><a href="#135"><img alt="" src="/library/content/dam/edam/applecare/images/en_US/il/spacer.png" width="76">iOS 13.5<br>
 &nbsp;&nbsp;</a>
<p><a href="#1351"><img alt="" src="/library/content/dam/edam/applecare/images/en_US/il/spacer.png" width="76">iOS 13.5.1<br>
 &nbsp;&nbsp;</a>

So if you are willing to adapt your script with each major release of iOS/iPadOS you could use

curl -s "https://support.apple.com/en-us/HT210393" | \
    sed -n '/\/library\/content/s|.*width="76">\([^<]*\)<.*|\1|p' | \
    tail -1

to get the most recent version available (iOS 13.5.1 right now).

  • sed -n runs sed suppressing any printing output unless specifically told so
  • /\/library\/content/ applies the following command to all lines matching /library/content
  • s|STRING-TO-MATCH|REPLACEMENT| does pattern-based string replacement
  • .*width="76">\([^<]*\)<.* takes the whole line and puts the part between width="76"> and the following < into \1
  • \1 just replaces the whole line with the content of \1 (which in this case is the version number)
  • p prints the result to stdout

This obviously matches (and prints) every line (just leave out the tail to check) so at the end we just take the last line.

What changes for sure with each major release is the URL, what might change is the code to find and extract the relevant content from the page. The sed/tail combination above works for iOS12 and iOS13 at least.

PS: You could avoid tail by running

curl -s https://support.apple.com/en-us/HT210393 | \
    sed -n '/\/library\/content/{s|.*width="76">\([^<]*\)<.*|\1|;h;}; ${g;p;}'

but this makes it hard to read for most people :-)