The Problem with Graphical Settings
If you need to change the name of your MacBook (the name that appears on the network when people try to AirDrop files to you), you simply open the graphical System Settings, click “General,” click “About,” and type a new name. It takes ten seconds.
However, what if you are a systems administrator deploying 500 MacBooks to a new university campus? You cannot physically sit at 500 laptops and click through graphical menus. You need to write a script that automatically renames every single machine based on its serial number and automatically configures its DNS networking settings. To interact with the deepest system configuration databases of macOS directly from the command line, you must use the scutil (System Configuration Utility) command.
Step 1: Open the Terminal
Because you are altering the core network identity of the machine, changing settings with scutil requires root administrator privileges (using sudo), though you can read the settings as a standard user.
- Press Command + Space to open Spotlight Search.
- Type
Terminaland press Enter.
Step 2: The Three Names of a Mac
Most users do not realize that a Mac actually has three completely different network names, and changing one in the graphical interface does not always correctly update the others.
- ComputerName: The friendly name you see in Finder and AirDrop (e.g., “John’s MacBook”).
- LocalHostName: The strict, URL-style name used by local networking protocols like Bonjour (e.g., “Johns-MacBook.local”).
- HostName: The absolute network name used by advanced command-line tools like SSH.
To view your Mac’s current ComputerName, you use the --get flag.
scutil --get ComputerName
The terminal will instantly output the friendly name. If you want to see the strict networking name, you run: scutil --get LocalHostName.
Step 3: Renaming the Mac via Terminal
If you are writing a deployment script, you need to forcefully update all three names simultaneously to ensure perfect network harmony.
To change the names, you use the --set flag, followed by the specific name type, and then the new name.
sudo scutil --set ComputerName "Marketing-Mac-01"
sudo scutil --set LocalHostName "Marketing-Mac-01"
sudo scutil --set HostName "Marketing-Mac-01"
These commands execute instantly and silently. The Mac’s identity on the entire corporate network is immediately updated without requiring a reboot.
Step 4: Managing DNS and Proxies
The scutil command is not just for naming computers; it is the master control valve for all macOS networking configurations.
If a Mac is failing to connect to the internet, and you suspect a malicious piece of software has hijacked the computer’s DNS settings to route traffic through a fake server, you can use scutil to perform deep diagnostics.
By using the --dns flag, you can force the operating system to dump its entire DNS routing table directly onto your screen.
scutil --dns
The terminal will output a massive, highly technical list showing exactly which DNS servers the Mac is currently using to resolve websites. If you see a bizarre, unknown IP address in that list instead of your corporate server or Google’s 8.8.8.8, you have found the exact cause of the network failure.
Similarly, you can use the --proxy flag to see if all web traffic is being secretly diverted through an invisible proxy server.
scutil --proxy
By mastering scutil, you gain absolute command-line authority over the foundational networking identity of any Mac.