--- title: "Set DNS Server on Mac" slug: "set-dns-server-on-mac" updated: 2026-02-09T12:00:27Z published: 2026-02-09T12:00:27Z canonical: "help.scalefusion.com/set-dns-server-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. # Set DNS Server on Mac The following Shell script helps IT Admins to set DNS server on their macOS devices. 1. Create a file on your desktop, for example, **set_dns_server.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/set_dns_server.sh) to download the file. ```bash #!/bin/bash # Configure the DNS Server here. For example: "8.8.8.8" DNS_SERVER="ENTER_DNS_SERVER" ###  DO NOT EDIT BELOW THIS ### WIFI_SERVICE="Wi-Fi" # Verify Wi-Fi service exists if ! networksetup -listallnetworkservices | grep -qx "$WIFI_SERVICE"; then  echo "Wi-Fi network service not found."  exit 1 fi echo "Configuring Wi-Fi DNS" echo "Setting DNS server to: $DNS_SERVER" networksetup -setdnsservers "$WIFI_SERVICE" "$DNS_SERVER" echo "Wi-Fi DNS configuration updated successfully." ``` 3. In the script, enter your DNS server against DNS_Server=”ENTER_DNS_SERVER” 4. When uploading the script, choose “**Run Script as signed-in user**” as ‘**No**’. ![](https://cdn.document360.io/175c0eac-012f-4410-bdc5-ac60794f82d8/Images/Documentation/image-NRH9ZD3R.png) 5. Follow [**our guide**](/docs/execute-shell-scripts-on-macos-devices-with-scalefusion) to upload & publish the Shell script using Scalefusion Dashboard. > [!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] > Note: > > 1. The scripts and their contents are sourced from various albeit authenticated Apple Developer communities and forums. > 2. Please validate the scripts on a test machine before deploying them on all your managed devices. > 3. Scalefusion has tested these scripts, however, Scalefusion will not be responsible for any loss of data or system malfunction that may arise due to the incorrect usage of these scripts.