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.

macOSnetworknetworksetupWi-FiLow risk
Run `networksetup -setairportpower en0 off` to disable Wi-Fi, or with `on` to switch it back on.

01Command

Command
$ networksetup -setairportpower en0 off

02What 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

RiskLow risk
RequirementsThe interface name is usually en0 for built-in Wi-Fi — confirm with `networksetup -listallhardwareports`.

04Undo

Undo
$ networksetup -setairportpower en0 on

05Sources

Last verified: 2026-09-18 · Category: System & Settings

06Related solutions