scutil — Query and Set System Configuration
Practical guide to scutil: set the computer name, hostname and LocalHostName, query DNS and proxy settings, and read the dynamic system store on macOS.
scutil is the command-line tool for querying and setting the dynamic system configuration on macOS – the same configuration that sits behind System Settings. With it you read and change the three computer names (ComputerName, HostName, LocalHostName), inspect the active DNS and proxy configuration, and check whether a host is reachable on the network. Through its interactive shell you also reach the dynamic store, where macOS keeps the current network and system state as key-value pairs. This guide walks you through the commands you actually need day to day – from reading the machine name to peeking into the network state.
Computer Names
scutil --get ComputerName — Show the computer name (user-friendly name).
scutil --get ComputerNamescutil --set ComputerName '<name>' — Set the computer name.
sudo scutil --set ComputerName 'My MacBook Pro'scutil --get HostName — Show the hostname (FQDN-style).
scutil --get HostNamescutil --set HostName '<name>' — Set the hostname.
sudo scutil --set HostName 'macbook.local'scutil --get LocalHostName — Show the local hostname (Bonjour name, used for .local).
scutil --get LocalHostNamescutil --set LocalHostName '<name>' — Set the local hostname (no spaces, used for .local).
sudo scutil --set LocalHostName 'macbook'DNS
scutil --dns — Show all DNS configuration (resolvers, search domains).
scutil --dnsscutil --dns | grep nameserver — Show only the active DNS nameservers.
scutil --dns | grep nameserverProxy
scutil --proxy — Show current proxy configuration.
scutil --proxyNetwork Reachability
scutil -r <host> — Check network reachability for a host.
scutil -r www.apple.comscutil -W -r <host> — Watch for reachability changes (blocks until change).
scutil -W -r www.apple.comDynamic Store (Interactive)
scutil — Enter the interactive scutil shell.
scutil> list — List all keys in the dynamic store (inside scutil).
> list> show <key> — Show the value of a dynamic store key.
> show State:/Network/Global/IPv4> show State:/Network/Interface/en0/IPv4 — Show IPv4 config of a specific interface.
> show State:/Network/Interface/en0/IPv4> quit — Exit the interactive scutil shell.
> quit Conclusion
scutil is the go-to tool on macOS when you want to manage system names and network state in a scriptable, reproducible way rather than clicking through the graphical settings. The --get queries and a look into the dynamic store are harmless and safe to run at any time. --set is a different matter: setting ComputerName, HostName or LocalHostName requires sudo, changes system-wide names, and immediately affects Bonjour and .local reachability on the network – wrong or inconsistent values can cause confusion there. Keep the three names consistent where possible, and avoid spaces and special characters in the LocalHostName.
Further Reading
- scutil(8) – macOS man page – official Apple man page covering all options
- SystemConfiguration – Apple Developer – documentation of the underlying framework
Related Commands
- caffeinate – prevent the Mac from going to sleep
- defaults – read and write the preferences system (plists)
- diskutil – manage disks, partitions and volumes