# Script to hide/disable different System Preferences panes on Mac

System administrators may have requirements to disable the different panes in *System Preferences* on an employee’s Mac to prevent users from making unwanted changes. With Hexnode’s [Execute Custom Script](https://www.hexnode.com/mobile-device-management/help/how-to-run-scripts-on-mac-using-hexnode-mdm/) action, admins can remotely hide or disable any System Preferences pane by executing the bash scripts below.

Scripting Language – Bash

File extension – .sh

 Disclaimer:- The sample scripts provided below are adapted from third-party open-source sites.
- The scripts provided below works only on devices running macOS versions below 13.0.

 

Disable any System Preferences pane
-----------------------------------

Script to disable any System Preferences pane

\#!/bin/sh defaults write "/Library/Preferences/com.apple.systempreferences" DisabledPreferencePanes -array "<CFBundleIdentifier>" 

   1

2

  \#!/bin/sh 

defaults write "/Library/Preferences/com.apple.systempreferences" DisabledPreferencePanes -array "<CFBundleIdentifier>" 

   

 

  

You can disable any *System Preferences* panes by specifying the correct **CFBundleIdentifier** in the script above.

**Preference Pane****CFBundleIdentifier**Accessibilitycom.apple.preference.universalaccessApple IDcom.apple.preferences.AppleIDPrefPaneBatterycom.apple.preference.batteryBluetoothcom.apple.preferences.BluetoothCDs & DVDscom.apple.preference.digihub.discsContent & Privacycom.apple.preferences.parentalcontrolsDisplayscom.apple.preference.displaysExtensionscom.apple.preferences.extensionsInternet Accountscom.apple.preferences.internetaccountsDate & Timecom.apple.preference.datetimeDesktop & Screen Savercom.apple.preference.desktopscreeneffectDock & Menu Barcom.apple.preference.dockGeneralcom.apple.preference.generalKeyboardcom.apple.preference.keyboardLanguage & Regioncom.apple.LocalizationMission Controlcom.apple.preference.exposeNetworkcom.apple.preference.networkNotificationscom.apple.preference.notificationsPasswordscom.apple.PasswordsPrinters & Scannerscom.apple.preference.printfaxProfilescom.apple.preferences.configurationprofilesScreen Timecom.apple.preference.screentimeSecuritycom.apple.preference.securitySharingcom.apple.preferences.sharingSidecarcom.apple.preference.sidecarSoftware Updatecom.apple.preferences.softwareupdateSoundcom.apple.preference.soundSiricom.apple.preference.speechSpotlightcom.apple.preference.spotlightStartup Diskcom.apple.preference.startupdiskTime Machinecom.apple.prefs.backupTouch IDcom.apple.preferences.passwordTrackpadcom.apple.preference.trackpadUsers & Groupscom.apple.preferences.usersFor example, executing the following script will grey out the *Bluetooth* pane from *System Preferences*, thus preventing the users from tampering with the Bluetooth settings.

Script to disable Bluetooth from System Preferences

\#!/bin/sh defaults write "/Library/Preferences/com.apple.systempreferences" DisabledPreferencePanes -array "com.apple.preferences.Bluetooth" 

   1

2

  \#!/bin/sh 

defaults write "/Library/Preferences/com.apple.systempreferences" DisabledPreferencePanes -array "com.apple.preferences.Bluetooth" 

   

 

  

[![Disabled Bluetooth preference pane](https://cdn.hexnode.com/mobile-device-management/help/wp-content/uploads/2023/03/Disable-Bluetooth-preference-pane-from-System-Preferences.png "Disable Bluetooth preference pane from System Preferences")](https://cdn.hexnode.com/mobile-device-management/help/wp-content/uploads/2023/03/Disable-Bluetooth-preference-pane-from-System-Preferences.png)To disable multiple *System Preferences* panes, specify the CFBundleIdentifiers of those preference panes in succession. For example, to disable both *Bluetooth* and *Network* from *System Preferences*:

Script to disable Bluetooth and Network from System Preferences

\#!/bin/sh defaults write "/Library/Preferences/com.apple.systempreferences" DisabledPreferencePanes -array "com.apple.preferences.Bluetooth" "com.apple.preferences.network" 

   1

2

  \#!/bin/sh 

defaults write "/Library/Preferences/com.apple.systempreferences" DisabledPreferencePanes -array "com.apple.preferences.Bluetooth" "com.apple.preferences.network" 

   

 

  

To re-enable the disabled preference panes, execute the script below:

Script to re-enable the disabled System Preferences panes

\#!/bin/sh defaults delete /Library/Preferences/com.apple.systempreferences DisabledPreferencePanes 

   1

2

  \#!/bin/sh 

defaults delete /Library/Preferences/com.apple.systempreferences DisabledPreferencePanes 

   

 

  

Hide any System Preferences pane
--------------------------------

You can also hide the unnecessary preference panes instead of greying them out. This comes handy when you want to clean up the *System Preferences* window by displaying only the required system settings to the user.

For example, the following script will hide the *Bluetooth* pane from *System Preferences*:

Script to hide Bluetooth from System Preferences

\#!/bin/sh defaults write "/Library/Preferences/com.apple.systempreferences" HiddenPreferencePanes -array "com.apple.preferences.Bluetooth" 

   1

2

  \#!/bin/sh 

defaults write "/Library/Preferences/com.apple.systempreferences" HiddenPreferencePanes -array "com.apple.preferences.Bluetooth" 

   

 

  

[![Hidden Bluetooth preference pane](https:2023/03/Hide-Bluetooth-preference-pane-from-System-Preferences.png "Hide Bluetooth preference pane from System Preferences")](https:2023/03/Hide-Bluetooth-preference-pane-from-System-Preferences.png)To unhide the hidden preference panes, execute the script below:

Script to unhide the hidden System Preferences panes

\#!/bin/sh defaults delete /Library/Preferences/com.apple.systempreferences HiddenPreferencePanes 

   1

2

  \#!/bin/sh 

defaults delete /Library/Preferences/com.apple.systempreferences HiddenPreferencePanes 

   

 

  

If you are looking to manage preference panes on devices running macOS 13.0 or above, refer to [Manage preference panes on Ventura](https://www.hexnode.com/mobile-device-management/help/script-to-manage-preference-panes-on-macos-ventura/).

 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.