# Script to enable/disable AirDrop on Mac

AirDrop is a built-in feature that allows users to wirelessly transfer various data and files between nearby Macs, iPhones, and iPods. AirDrop feature offers a seamless experience with the quick transfer of data and files between Apple devices. However, AirDrop functionality becomes critical for security and compliance strategies in a corporate environment. Disabling AirDrop functionality significantly reduces risk by restricting file transfers via AirDrop to personal or other Apple devices. It will prevent data leakage, and admins can have full control over users’ file sharing on Apple devices. This level of restriction is crucial in a corporate environment where security and data privacy are top priorities.

You can restrict AirDrop functionality by executing dedicated terminal commands. This doc provides you with scripts that can be used to disable or re-enable AirDrop functionality on macOS devices. You can execute these scripts remotely on Macs with the help of Hexnode’s The [Execute Custom Scripts](https://www.hexnode.com/mobile-device-management/help/how-to-run-scripts-on-mac-using-hexnode-mdm/) feature.

 Disclaimer:The sample scripts provided below are adapted from third-party open-source sites.

 

Script to disable AirDrop functionality
---------------------------------------

Execute this script to disable the AirDrop functionality:

Script to disable AirDrop

\#!/bin/sh sudo ifconfig awdl0 down 

   1

2

3

  \#!/bin/sh 

sudo ifconfig awdl0 down 

   

 

  

Script to enable AirDrop functionality
--------------------------------------

The following script helps you to re-enable AirDrop functionality:

Script to enable AirDrop

\#!/bin/sh sudo ifconfig awdl0 up 

   1

2

3

  \#!/bin/sh 

sudo ifconfig awdl0 up 

   

 

  

What happens at the device end?
-------------------------------

Once the “Disable AirDrop” script is executed, the AirDrop functionality will be disabled on the device’s end. This will prevent the user from turning on AirDrop and prohibit data and file transfers through AirDrop. However, it enhances security by restricting unauthorized file transfers.

Upon running the “Enable AirDrop” script, users will retain the privileges to control AirDrop functionality as needed. It allows them to wirelessly transfer data and files to nearby Apple devices.

 Notes:- It is recommended to manually validate the script execution on a system before executing the action in bulk.
- Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.