networksetup
networksetupConfiguration tool for network settings in System Settings.
Runs as
networksetup|macOSConfiguration tool for network settings in System Settings.
networksetup|macOSInspect a network service, set its DNS servers, or switch Wi-Fi power. Run it with sudo where macOS requires it.
networksetup -getinfoIP address, subnet mask, router and hardware address of a service.
servicestring · positional 0Wi-FiEthernetnetworksetup -setdnsserversUse "empty" in place of a server to clear all DNS entries.
servicednsstring · positional 0Wi-FiEthernetstring · positional 1 · repeatableemptynetworksetup -setairportpowerTurn Wi-Fi power on or off for a hardware port.
portstatestring · positional 0en0enum · positional 1onofffigcompletionfigcompletionfigcompletionfigcompletionBefore it fills your prompt, Otty checks the installed networksetup against its version. A form that does not match your version is not offered.