The airport command is a powerful utility for managing
and inspecting wireless network configurations on macOS. It provides
a command-line interface to interact with your Wi-Fi adapter,
offering insights and control that are not always readily available
through the graphical user interface. This tool is invaluable for
network administrators, developers, and power users who need to
diagnose network issues, monitor Wi-Fi activity, or simply gain a
deeper understanding of their wireless environment.
Here are some of the most common and useful commands you can execute
with the airport utility:
To check the current status of your wireless network interface,
including connection details, signal strength, and network
information, use the -I flag:
airport -I
Discover all available Wi-Fi networks in your vicinity by running
the -s flag. This command lists SSIDs, signal levels,
channels, and security types of nearby access points:
airport -s
For advanced network analysis, the sniff command allows
you to capture wireless traffic on a specific channel. This is
useful for debugging network protocols or understanding data flow.
Remember to specify the channel number:
airport sniff 1
If you need to disconnect from the currently connected Wi-Fi
network, the -z flag will disassociate your device:
airport -z