Enable or Disable a Network Service with networksetup
Toggle macOS network services (Wi-Fi, Ethernet, VPN) on and off without deleting their settings.
Run `sudo networksetup -setnetworkserviceenabled <service> off/on` to disable or re-enable the service while keeping its configuration.
01Command
Command
$ sudo networksetup -setnetworkserviceenabled Wi-Fi off
networksetup -listallnetworkservices02What it does
This is distinct from powering the radio off: `-setnetworkserviceenabled` flips the service's on/off switch in the network preferences pane, so all saved settings (IP, DNS, proxies) survive. It is the cleanest way to script 'turn off Wi-Fi service' for kiosk machines or to disable a broken Ethernet entry temporarily. List valid service names with `-listallnetworkservices` — names are case-sensitive.
03Risk
!Warning: Disabling the service you are connected through will immediately sever your session.
04Undo
Undo
$ sudo networksetup -setnetworkserviceenabled Wi-Fi on05Sources
- networksetup — macOS Command ReferenceEvidence: Documents -setnetworkserviceenabled and -listallnetworkservices.
Last verified: 2026-09-17 · Category: Network