Disable AirDrop from command line in Mojave?

kush
New Contributor

Hi all. I'm looking for some help in how to disable AirDrop via the command line in Mojave. The plist used to do this in High Sierra doesn't seem to exist on any of my Mojave devices.

I know this can be done via configuration profile but I need to know how to do it via the command line so I can write some scripts to check whether or not it's been disabled.

Thanks in advance!

2 REPLIES 2

rquigley
Contributor

Only method I'm aware of disabling AirDrop is through a configuration profile.

In which case, you can use smart groups for machines that don't have that configuration profile installed in which case will tell you whether or not it is disabled.

easyedc
Valued Contributor II

@adamcodega 's script has worked for me. You can set this to be a daily policy, or if there's a different need then set it up how you need to. There is some gotcha to this though. Turning Wi-Fi back on will turn airdrop back on. We use this frequently as our DLP software (Digital Guardian) has a dual homing rule that see the airdrop port as a way out, and must be turned off before network access is granted.

#!/bin/bash
# 
# swipely-disable-awdl0.sh
#
# Check if awdl0 interface is active,
# if it is, then disable it.
# 
# awdl0 has been documented to cause Wi-Fi issues on OS X Yosemite 10.10-10.10.2
# 
# This script can run at startup using a JSS policy and "User login" as trigger
#
# (Or launchd/offset if that's your thing.)
# 
# https://medium.com/@mariociabarra/wifried-ios-8-wifi-performance-issues-3029a164ce94
# 
# Adam Codega, Swipely
#

# set awdl0 status as a variable

awdlstatus=$(ifconfig awdl0 | awk '/status/{print $2}')

# find out if awdl0 is already inactive, if it is, end script. If it's not, disable it.

if [ "$awdlstatus" = "inactive" ]; then
        end
else
        ifconfig awdl0 down
fi