Skip to content

Instantly share code, notes, and snippets.

@attilagyorffy
Created November 12, 2020 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save attilagyorffy/3393fcb6014b99cb2d56c7be1f522728 to your computer and use it in GitHub Desktop.
Save attilagyorffy/3393fcb6014b99cb2d56c7be1f522728 to your computer and use it in GitHub Desktop.
Excited about the imminent availability of Big Sur but tired of checking the software update pane in System Preferences? Use this Ruby script to automate it and get a notification once it's available in your region.
# NOTE: This script assumes that you system is otherwise updated, ie no other update is pending.
# You can add this script into crontab to run every 5 mins: */5 * * * *
require 'open3'
Open3.popen3("softwareupdate -l --force") do |_stdin, _stdout, stderr, _thread|
unless stderr.read.match? /No new software available./
exec(%q{osascript -e "display notification \"You have an update available.\""})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment