I have the following .sh script that deletes Sierra, upon download, from the App store. This applies to any user on mac osx 10.10 or 10.11.

However can someone add the code so that the app (sierra.app) actually deletes as soon as it starts downloading as opposed to when its finished downloading which is what it presently does.

In addition the osascript display message does not display once it has deleted. How can I get that to work?

Here is the script.


Version=$(sw_vers | grep ProductVersion | tail -c 7 | cut -d . -f 2)    

if [[ $Version -ge 12 ]]
launchctl unload /Library/LaunchDaemons/net.infor.sierra.plist
rm -f /Library/LaunchDaemons/net.infor.sierra.plist
rm -f /usr/local/bin/sierra.sh
exit 0

rm -rf /Applications/Install\ macOS\ Sierra.app/
osascript -e 'tell app "System Events" to display dialog "macOS sierra is not allowed on computers at this time." with title "Technology Notice" buttons {"OK"} default button "OK" giving up after 30'

Here is the plist.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com    /DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <key>/Applications/Install macOS Sierra.app/</key>
  • Not an answer, just a comment, but FWIW, instead of using three pipes and three utilities to process the output of sw_vers, i.e. sw_vers | grep ProductVersion | tail -c 7 | cut -d . -f 2, just use awk by itself to do all what grep,tail and cut are doing, e.g.: Version=$(sw_vers | awk '{FS = "."};/ProductVersion/{print $2}') Commented Sep 22, 2016 at 16:17
  • Daemons run without a GUI. Agents can attach to the window server.
    – fd0
    Commented Sep 22, 2016 at 17:04
  • fd0 How come when i create a test script to make a directory called Install macOS Sierra.app not only does the .app delete but the splash message appears?
    – sql1
    Commented Sep 23, 2016 at 8:12

1 Answer 1


not really an answer, but maybe a hint as to where to go next...

To catch it earlier, you'd have to intercept it at the download folder. I'd guess the folder name will be different for everybody - mine is at

You can find it from the App Store app > Debug > Show Download Folder... if you enable the debug menu with
defaults write com.apple.appstore ShowDebugMenu -bool true

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .