# Script to hide Profiles pane from System Preferences on macOS devices

Being the IT administrator of a school or business organization, you might have requirements where you need to hide or disable the *Profiles* pane from *System Preferences* on your Mac endpoints. This way, you can prevent users from tampering with the installed profiles and avoid making any configuration errors on the devices. With Hexnode’s [Execute Custom Script](https://www.hexnode.com/mobile-device-management/help/how-to-run-scripts-on-mac-using-hexnode-mdm/) action, you can remotely hide/disable the *Profiles* pane on your devices using this bash script.

Scripting language – Bash

File extension – .sh

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

 

Script to disable Profiles pane
-------------------------------

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

   1

2

  \#!/bin/sh 

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

   

 

 On running the above script, the *Profiles* pane will be greyed out from the *System Preferences* tab on the device.

For example, the following script will disable *Bluetooth* in addition to the *Profiles* pane:

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

   1

2

  \#!/bin/sh 

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

   

 

 Script to re-enable a disabled Profiles pane
--------------------------------------------

To re-enable the disabled panes, run the below script on the endpoint devices.

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

   1

2

  \#!/bin/sh 

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

   

 

  Note:The above scripts for disabling/re-enabling a disabled Profiles pane are applicable to macOS devices running version 10.2 and later.

 

Script to hide Profiles pane
----------------------------

By changing the key from DisabledPreferencePanes to HiddenPreferencePanes, you can configure the *Profiles* pane to be hidden rather than greyed out.

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

   1

2

  \#!/bin/sh 

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

   

 

 You can disable/hide any *System Preferences* pane using this script. All you have to do is [identify the correct Bundle identifier](https://developer.apple.com/documentation/devicemanagement/systempreferences) for the required pane and include it in the script by following the correct syntax.

Script to unhide Profiles pane
------------------------------

Panes hidden earlier can be selectively revealed by running the *Hide Profiles* pane script, but with the package names of those panes removed. For instance, consider the script which hides both the *Profiles* pane and the *Bluetooth* pane:

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

   1

2

  \#!/bin/sh 

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

   

 

 Now, run the script below to reveal only the hidden *Profiles* pane.

\#!/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" 

   

 

 To reveal all hidden panes under *System Preferences*, run the script provided below.

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

   1

2

  \#!/bin/sh 

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

   

 

  Notes:- The above scripts for hiding/unhiding Profiles pane are applicable to macOS devices running version 13.0 and later.
- 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.