macOS commands

macOS commands

# networking

List all commands for networksetup.

networksetup -help
networksetup -printCommands

List all network services or hardware ports (device names).

networksetup -listallnetworkservices
networksetup -listallhardwareports

Toggle Wi-Fi networking service. Get the value with "-get...".

networksetup -setnetworkserviceenabled Wi-Fi off

Toggle Wi-Fi power, when "en0" is the device name with the Wi-Fi. Get the value with "-get...".

networksetup -setairportpower en0 off

# system

systemsetup is the command for sleep settings, date and network time, and power failure or system freeze.

sudo systemsetup -help