Skip to content

airport MacOS Command Guide

The MacOS airport command is a powerful tool for managing Wi-Fi connections and networks. It allows users to scan for available networks, gather detailed information about network configurations, join specific networks, and more. By using the airport command, users can troubleshoot connectivity issues, optimize network performance, and customize their Wi-Fi settings with ease.

airport Syntax:

Terminal window
airport [options] [parameters]

Options:

OptionDescription
-sShow scan results
-ASet the preferred network
-IGet network information
-zDisassociate from current network

Parameters:

ParameterDescription
networknameName of the network to join
passwordPassword for the network
channelSpecify the channel to join

airport Command Samples:

Scan for Wi-Fi Networks

Terminal window
airport -s

Scans for available Wi-Fi networks and displays a list of nearby networks with their details.

Connect to a Specific Wi-Fi Network

Terminal window
airport -A "WiFiNetwork"

Connects to a Wi-Fi network with the specified SSID (“WiFiNetwork”).

Display Wireless Diagnostics Window

Terminal window
airport -F

Opens the Wireless Diagnostics window for troubleshooting and analyzing Wi-Fi connections.

Turn Wi-Fi on

Terminal window
airport -z

Turns on the Wi-Fi interface, enabling wireless connectivity.

Forget a Known Wi-Fi Network

Terminal window
airport -z -A "WiFiNetwork"

Forgets a known Wi-Fi network with the specified SSID (“WiFiNetwork”).

Enable Debug Logging

Terminal window
airport -d

Activates debug logging for the airport command, providing detailed information about Wi-Fi operations.

Show Wi-Fi Hardware Information

Terminal window
airport -I

Displays detailed information about the Wi-Fi hardware, including the chipset, firmware version, and supported standards.

airport FAQ:

How do I use airport in MacOS?

To use the airport command in MacOS, execute the following command:

Terminal window
airport --getinfo

What is the purpose of the airport command?

The airport command in MacOS is used to interact with the wireless network interface and provides various functionalities for managing Wi-Fi connections.

How can I scan for available Wi-Fi networks using airport?

To scan for available Wi-Fi networks using the airport command, you can run the following command:

Terminal window
airport -s

Can I enable or disable Wi-Fi using the airport command?

Yes, you can enable or disable Wi-Fi using the airport command. To turn Wi-Fi on, use the following command:

Terminal window
networksetup -setairportpower en0 on

How can I connect to a specific Wi-Fi network using airport?

To connect to a specific Wi-Fi network using the airport command, you can run the following command:

Terminal window
networksetup -setairportnetwork en0 SSID password

Is it possible to disconnect from a Wi-Fi network using airport?

Yes, you can disconnect from a Wi-Fi network using the airport command. To disconnect, you can use the following command:

Terminal window
networksetup -setairportpower en0 off

Applications of the airport command

  • Scan for Wi-Fi networks
  • Turn Wi-Fi on/off
  • Join a specific Wi-Fi network
  • Disconnect from a Wi-Fi network
  • Get information about the current Wi-Fi connection
  • Set preferred networks
  • Create and manage network profiles
  • Generate Wi-Fi diagnostics
  • Perform wireless packet capture