I'm hoping that you can help me with creating a unix script for sending a terminal command through ARD to multiple networked computers. I'm hoping to disable air drop on a set of 36 lab computers at my school. I can definitely manually enter the script below to turn off air drop, but it would be great if I could just do this "behind the scenes" and 36 at a time.

The script that works is:

 defaults write com.apple.NetworkBrowser DisableAirDrop -bool YES

I have limited knowledge of scripting/UNIX/ARD, but I'd love to learn. So far, all I've gotten is for terminal to open: open /Applications/Utilities/Terminal.app

However, I cannot get the script/text to run. Any help is greatly appreciated! Thanks,


Don't bother with Terminal; ARD can run shell commands directly on the computers. Just select the computers you want to run it on, click the UNIX button in the toolbar (or choose Manage menu > Send UNIX Command). A window will open that lets you paste in the command/script you want to run, and select what user to run it as.

But it's a little more complicated than that, because you're changing a per-user setting. If you run the command as root, it'll only take effect if someone logs in as root, which (hopefully) nobody ever does. If you select "Current console user on target computer", it'll run as whoever's logged in at the moment, if someone's logged in. Do you have multiple users using the same computer and/or logging out between usages? If so, it's going to get set for some users but not others.

I think this short script will work to set the setting for all current user accounts (everyone with a home directory in /Users) and also adjust the user templates so that new users will get this setting as well. Note that this script must be run as root, and won't take effect for current users until they log out & back in.

# Disable AirDrop for current users
for userdir in /Users/*; do
    if [ -d "$userdir/Library" ]; then # only do this for "real" users
        sudo -u "${userdir##*/}" defaults write com.apple.NetworkBrowser DisableAirDrop -bool YES

# Disable AirDrop in the user templates, so new user accounts come with it pre-disabled
for templatedir in "/System/Library/User Template"/*; do
    defaults write "$templatedir/Library/Preferences/com.apple.NetworkBrowser" DisableAirDrop -bool YES

WARNING: I have not tested this script. Try it out on one or a few computers that you can clean up or reimage easily if something goes wrong.

  • Gordon- that worked out perfectly. Indeed, I was able to send the command directly from the Unix command window. I verified that Air Drop no longer opens on multiple profiles- thank you for all your help! – Andrew Berg Nov 3 '17 at 14:25

You must log in to answer this question.

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