--- title: "Block Safari browser on Mac" slug: "block-safari-browser-on-mac" updated: 2026-02-09T11:45:01Z published: 2026-02-09T11:45:01Z canonical: "help.scalefusion.com/block-safari-browser-on-mac" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.scalefusion.com/llms.txt > Use this file to discover all available pages before exploring further. # Block Safari browser on Mac The following script permanently blocks Safari for the current user by force-closing it every time it starts, using a LaunchAgent that runs in the background. - Creates a background script that continuously checks if Safari is running. - Kills Safari immediately if it is found. - Registers that script as a LaunchAgent. - Ensures it starts at login and continues to run. - Result: Safari cannot be opened at all for that user. #### Block Safari on Mac 1. Create a file on your desktop, for example, **Block_Safari.sh**, and open it in a text editor like Notepad++. 2. Copy the contents below to the file or click [**here**](https://cdn.document360.io/175c0eac-012f-4410-bdc5-ac60794f82d8/Images/Documentation/Block_Safari.sh) to download the file. ```bash #!/bin/bash # Define the LaunchAgent plist file location LAUNCH_AGENT_DIR="$HOME/Library/LaunchAgents" LAUNCH_AGENT_FILE="$LAUNCH_AGENT_DIR/com.user.safari.block.plist" SCRIPT_PATH="$HOME/Library/Scripts/block_safari.sh" # Step 1: Create the block_safari.sh script mkdir -p "$HOME/Library/Scripts"  # Create the Scripts directory if it doesn't exist cat > "$SCRIPT_PATH" < "$LAUNCH_AGENT_FILE" <      Label    com.user.safari.block    ProgramArguments          $SCRIPT_PATH        RunAtLoad        KeepAlive       EOL # Step 3: Load the LaunchAgent so that it starts immediately launchctl load -w "$LAUNCH_AGENT_FILE" # Step 4: Inform the user that the launch agent is running echo "Safari blocking agent has been deployed and is now running." ``` 3. Follow our [**guide**](/docs/execute-shell-scripts-on-macos-devices-with-scalefusion) to upload & publish the Shell script using the Scalefusion Dashboard. 1. When uploading the script, please select **"No"** for the option "**Run script as signed-in user**". ![](https://cdn.document360.io/175c0eac-012f-4410-bdc5-ac60794f82d8/Images/Documentation/image-6G9AY64I.png) #### Restrict users from turning off Safari block The following payload restricts the user to toggle off the login/background item whose Label is com.user.safari.block by going to General > Login Items & Extensions > App Background Activity. 1. Copy the contents below directly and add them to **Apple Configurations** > **Custom Configurations** for Mac, or click [**here**](https://cdn.document360.io/175c0eac-012f-4410-bdc5-ac60794f82d8/Images/Documentation/EnforceSafariBlocking.mobileconfig) to download the file and import it. ```bash PayloadContent PayloadDisplayName Service Management - Managed Login Items PayloadIdentifier com.apple.servicemanagement.5C8FEBF2-EB63-43CB-A5E1-28B35FAF6725 PayloadType com.apple.servicemanagement PayloadUUID 5C8FEBF2-EB63-43CB-A5E1-28B35FAF6725 PayloadVersion 1 Rules RuleType Label RuleValue com.user.safari.block PayloadDescription This payload enforce Safari blocking script PayloadDisplayName Enforce Safari Script PayloadIdentifier com.promobitech.scalefusion.40E117C6-A5C4-410C-8E91-0F73286D3DEC PayloadOrganization Scalefusion PayloadType Configuration PayloadUUID 40E117C6-A5C4-410C-8E91-0F73286D3DEC PayloadVersion 1 ``` 2. Follow [**our guide**](/docs/custom-configuration-ios-and-macos) on how to add the Custom Payload in the Apple Configurations & deploy it to devices. ![](https://cdn.document360.io/175c0eac-012f-4410-bdc5-ac60794f82d8/Images/Documentation/image-YOQYRG71.png) > [!NOTE] > Note: > > Please note that to use the Shell scripts, the **Scalefusion MDM Client Application** must be **installed** on the device(s). Please follow our [**guide**](/docs/scalefusion-mdm-agent-application-for-mac-devices) to publish and install the Scalefusion MDM Agent Application. > [!CAUTION] > Notes: > > 1. The Payload and its contents are sourced from various albeit authenticated Apple Developer communities and forums. > 2. Please validate them on a test machine before deploying them on all your managed devices. > 3. Scalefusion has tested these Payloads, however, Scalefusion will not be responsible for any loss of data or system malfunction that may arise due to the incorrect usage of these payloads.