Turn Wi-Fi On or Off with networksetup
networksetup -setairportpower switches the Wi-Fi hardware on or off, the same toggle the Wi-Fi menu performs.
Run `networksetup -setairportpower en0 off` to disable Wi-Fi, or with `on` to switch it back on.
01Command
Command
$ networksetup -setairportpower en0 off02What it does
This is the command-line equivalent of clicking the Wi-Fi switch in the menu bar. It needs no sudo because it only changes the power state of your own machine's radio. Confirm the right device name first: on most laptops built-in Wi-Fi is en0, but desktop Macs with an Ethernet adapter may use a different index. Toggling the radio is also the quickest way to make macOS re-scan and reconnect after a flaky connection.
03Risk
04Undo
Undo
$ networksetup -setairportpower en0 on05Sources
- networksetup — network configuration tool (macOS man page)Evidence: Documents -setairportpower <device> on|off to switch the wireless interface power state.
Last verified: 2026-09-18 · Category: System & Settings