SkillPilotAI

scutil + scselect, sharing, airport, ARD kickstart

macOS-only command-line tools for the live network state (scutil), network locations (scselect), SMB file sharing (sharing), legacy Wi-Fi info (airport) and remote management (ARD kickstart). scutil --dns in particular is the right way to see which DNS a Mac is really using.

31.1 What they do and where they run

  • All of these run only on macOS; scutil, scselect and sharing live in /usr/sbin and need sudo for any change.
  • airport is an old private Wi-Fi utility that is deprecated and stops working from macOS 14.4; use sudo wdutil info or system_profiler instead.
  • kickstart lives inside the ARD (Apple Remote Desktop) agent and turns Remote Management on or off.
  • In the video the Mac screens show documented example output, and the same checks are run for real on a Linux lab container.

31.2 How scutil works: it talks to configd

  • scutil stores nothing itself; it sends a request to configd, the macOS System Configuration daemon.
  • configd holds the live Dynamic Store (current IP, DNS, router) and the saved preferences (locations, services).
  • The answer comes from configd, so scutil always shows what the Mac is actually using right now.
scutil -r: reachability without sending a packet
  1. 1.Office Mac 192.168.1.10 runs scutil -r <target>

  2. 2.scutil asks configd, which checks only the routing table and interface

  3. 3.Printer 192.168.1.20 on the same LAN -> Directly Reachable (Mac -> switch -> printer)

  4. 4.8.8.8.8 -> Reachable (traffic would go Mac -> switch -> router 192.168.1.1 -> internet)

  5. 5.The Mac's own IP -> Local Address

  6. 6.No route or link -> Not Reachable

No packet leaves the Mac: it is a route check, not a liveness test

31.3 scutil interactive modes

Output
scutil              live Dynamic Store shell> help              all shell commands> list              all keys> show <key>        value of one key> quit              leave the shell scutil --prefs      saved preferences shellsudo scutil --prefs <file>                    open a specific plist echo 'show State:/Network/Global/IPv4' \  | scutil  primary interface + router

31.4 scutil --dns, --proxy and --renew

  • scutil --dns: the DNS resolvers the Mac really uses, including per-domain resolvers.
  • Resolver #1 is the default (nameserver 192.168.1.1 via en0); resolver #2 is only for corp.example.com and goes to 10.8.0.53. This is split DNS, common with VPNs.
  • scutil --proxy: the current proxy or PAC file.
  • sudo scutil --renew en0: re-evaluates that interface, like a DHCP renew.
Terminal
scutil --dnsscutil --proxysudo scutil --renew en0
Output
$ scutil --dnsresolver #1  nameserver[0] : 192.168.1.1  if_index : 6 (en0)  reach    : 0x00020002 (Reachable,Directly Reachable)resolver #2  domain   : corp.example.com  nameserver[0] : 10.8.0.53

31.5 scutil -r: reachability

Output
scutil -r example.com     name reachable?scutil -r 8.8.8.8         IP reachable?scutil -r 192.168.1.10 8.8.8.8                          local to remotescutil -r -W example.com  watch modescutil -r 192.168.1.1     Directly Reachablescutil -r 127.0.0.1       Local Address
ResultMeaning
ReachableGoes via the gateway
Directly ReachableSame LAN, no gateway
Local AddressThis Mac's own IP
Not ReachableNo route or link
Transient Connection / Connection RequiredSeen with VPN and on-demand links

31.6 Dynamic store keys (-w) and VPN (--nc)

Output
scutil -w State:/Network/Global/IPv4  wait for the key, exit 0 when found  default wait 15 sscutil -w State:/Network/Global/IPv4 \  -t 60  max 60 s, -t 0 = wait forever scutil --nc help  VPN sub-commandsscutil --nc list  configured VPNs and their statusscutil --nc start "Office VPN"scutil --nc stop "Office VPN"

31.7 Names (--get / --set)

NameWhere it is usedExample
ComputerNameFinder, AirDropOffice Mac
LocalHostNameBonjour .local name (no spaces, no dots)office-mac
HostNameShell prompt, hostname command; can be unsetoffice-mac.example.com
Terminal
scutil --get ComputerNamescutil --get LocalHostNamescutil --get HostName sudo scutil --set ComputerName "Office Mac"sudo scutil --set LocalHostName office-macsudo scutil --set HostName office-mac.example.com

31.8 Practical: the same checks on Linux

  • Docker container office-mac (192.168.51.10) stands in for the Mac.
  • hostname = scutil --get HostName; resolv.conf + dig SERVER line = scutil --dns.
  • ip route get also sends no packet, so it is the Linux twin of scutil -r: no via = Directly Reachable, via = Reachable, local = Local Address, Network unreachable = Not Reachable.
Terminal
hostnamegrep nameserver /etc/resolv.confdig example.com | grep -E 'SERVER|^example'ip route get 192.168.51.20ip route get 8.8.8.8ip route get 192.168.51.10ip route del defaultip route get 8.8.8.8
Output
$ hostnameoffice-mac$ grep nameserver /etc/resolv.confnameserver 127.0.0.11$ dig example.com | grep -E 'SERVER|^example'example.com.    300  IN  A  104.20.23.154example.com.    300  IN  A  172.66.147.243;; SERVER: 127.0.0.11#53(127.0.0.11) (UDP)$ ip route get 192.168.51.20192.168.51.20 dev eth0 src 192.168.51.10 uid 0$ ip route get 8.8.8.88.8.8.8 via 192.168.51.1 dev eth0 src 192.168.51.10 uid 0$ ip route get 192.168.51.10local 192.168.51.10 dev lo src 192.168.51.10 uid 0$ ip route del default$ ip route get 8.8.8.8RTNETLINK answers: Network unreachable

31.9 scselect and networksetup locations

  • A location is a saved set of network settings, e.g. Home = Wi-Fi DHCP, Office = static IP + proxy.
  • scselect with no argument lists locations; the one with * is active.
  • sudo scselect Office switches immediately (a name or the unique ID works); -n delays the switch until next boot.
  • networksetup does the same: -listlocations, -getcurrentlocation, -createlocation Lab populate, -deletelocation, -switchtolocation.
Terminal
scselectsudo scselect Officesudo scselect \  4D7A3B2C-1E5F-4A6B-9C8D-0E1F2A3B4C5Dsudo scselect -n Home networksetup -listlocationsnetworksetup -getcurrentlocationsudo networksetup -createlocation Lab populatesudo networksetup -deletelocation Labsudo networksetup -switchtolocation Lab
Output
$ scselect   Automatic   (default)   Home        (Wi-Fi DHCP) * Office      (Eth static + proxy)
In the office: location, share, remote access
  1. 1.sudo scselect Office: IP, DNS and proxy change together

  2. 2.sudo sharing -a turns a folder into an SMB share point on the Mac (192.168.1.10)

  3. 3.Colleague PC 192.168.1.30 -> office switch -> Mac on TCP 445 (SMB)

  4. 4.sudo kickstart -activate ... turns on Remote Management

  5. 5.IT admin 192.168.1.40 -> switch -> Mac via Screen Sharing (remote control)

31.10 sharing: actions and share point attributes

OptionWhat it does
-a <path>Add a new SMB share point
-e <name>Edit an existing share point
-r <name>Delete a share point
-l [-f json]List share points (optionally as JSON)
-S TeamFilesName seen over SMB
-n DocsShareCustom record name
-s 001 / 000SMB sharing on (default) / fully off
-g 001 / 000Guest access on (default) / off
-R 1 / 0Read-only / allow writes
-E 1 / 0Encryption required (SMB 3) / off
Terminal
sudo sharing -a /Users/Shared/Projectssudo sharing -e Projects -S ProjSharesudo sharing -r Projectssharing -l -f json # read-only + encrypted sharesudo sharing -a /Users/Shared/Reports -R 1 -E 1

31.11 airport (deprecated)

  • Long private path, so people symlink it to /usr/local/bin/airport first.
  • -I current connection, -s scan (optionally one SSID, -x for XML), sudo -z disconnect, -c channel, en0 sniff 6 captures raw frames.
  • Example: RSSI -55, noise -92 -> SNR 37 dB (a good signal); channel 36 = 5 GHz band.
  • Non-functional from macOS 14.4: use sudo wdutil info or system_profiler.
Output
$ airport -I     agrCtlRSSI: -55    agrCtlNoise: -92           SSID: OfficeWiFi        channel: 36,80

31.12 ARD kickstart

  • -activate / -deactivate: service on / off (deactivate also stops the agent); -stop keeps the config.
  • -configure -access -on|-off with -users and -privs decides who connects and with which rights.
  • -allowAccessFor -allUsers | -specifiedUsers; -restart -agent after changes.
  • From macOS 12.1 kickstart cannot enable Remote Management by itself without MDM.
Terminal
sudo kickstart -activate -configure \  -access -on -users admin -privs -all \  -restart -agent

31.13 Common mistakes

  • Thinking scutil -r Reachable means the server is up: it only checks route and interface. Test with ping, curl or nc.
  • Reading /etc/resolv.conf on a Mac: it misses split DNS and per-domain resolvers; use scutil --dns.
  • Putting spaces or dots in LocalHostName.
  • Still relying on airport on macOS 14.4+.

31.14 Interview tips

  • "How do you check real DNS on a Mac?" -> scutil --dns, because macOS uses split DNS and per-domain resolvers from configd.
  • VPN on, public sites fine, corp name fails -> run scutil --dns first to see if corp.example.com has its own resolver.
  • scutil -r is a routing check, not a liveness check.
  • Know the three Mac names: ComputerName, LocalHostName, HostName.
  • Linux equivalent of scutil -r is ip route get.