Airport Command Line Utility: What It Is & How to Use
- Signal strength (dBm)
- -50 dBm
- You entered
- Frequency (GHz)
- 5 GHz
- You entered
The Airport command line utility is a little-known macOS tool that lets you control Wi-Fi and create or join wireless networks directly from the Terminal, bypassing the graphical AirPort menu. It’s especially useful for scripting, troubleshooting, and inspecting nearby networks. This article explains what the utility does, how to use it, and where it fits in modern macOS.
Formula
The calculator estimates the distance to a Wi-Fi access point using the free-space path loss formula:
Distance (m) = 10 ^ ((27.55 – (20 × log10(Frequency_MHz)) + |RSSI|) / 20)
- RSSI – Received Signal Strength Indicator in dBm (typically between -30 and -90).
- Frequency – The Wi-Fi band in GHz (2.4 or 5).
- Distance – Estimated distance in meters, assuming no obstacles.
This is a simplified model; real-world walls and interference reduce accuracy.
Worked Example
Using the default values: RSSI = -50 dBm, Frequency = 5 GHz.
- Convert frequency to MHz: 5 GHz × 1000 = 5000 MHz.
- Compute 20 × log10(5000) = 20 × 3.699 = 73.98.
- Add 27.55 – 73.98 + |−50| = 27.55 – 73.98 + 50 = 3.57.
- Divide by 20: 3.57 / 20 = 0.1785.
- Distance = 10^0.1785 ≈ 1.5 meters.
The calculator outputs approximately 1.5 m, matching the formula.
What Is the Airport Utility?
The airport command is a hidden binary that has shipped with macOS for years. It lives at /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport. It provides a command-line interface to the same Wi-Fi hardware that the menu bar uses, allowing you to scan networks, join networks, and read signal strength. It’s not an official Apple-supported tool, so it’s not documented in man pages, but it remains present in many macOS versions.
How to Access It
Because the binary is deep inside the system, you normally create a symbolic link to make it easier to call:
- Open Terminal (Finder > Applications > Utilities > Terminal).
- Run:
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport - Enter your password when prompted.
- Now you can type
airportfrom any directory.
If you don’t want to create a link, you can use the full path each time.
Common Uses
Here are the most frequent tasks people perform with the airport utility:
- Scan for networks:
airport -slists nearby SSIDs, BSSIDs, RSSI, channel, and security type. - Join a network:
airport -Aorairport --joinlets you connect to a network from the command line. - Disconnect:
airport -zdisconnects from the current network. - Check current status:
airport -Ishows your current SSID, signal strength, and IP info. - Sniff packets:
airport -sniffcaptures raw 802.11 frames (requires sudo).
How to Choose the Right Command
Each option has a specific purpose. If you want to see what networks are available, use -s. If you need to connect to a specific one, use --join with the SSID and password. For troubleshooting a weak signal, -I gives you the RSSI. For advanced packet analysis, -sniff is the tool, but it’s mostly for network engineers. Choose the command based on what you’re trying to do: scanning, connecting, or diagnosing.
Common Problems and Solutions
Users often run into these issues:
- “airport: command not found� – You haven’t created the symlink or the binary isn’t present (macOS versions after Catalina may have removed it). Use the full path or check if the file exists.
- Permission denied – Some commands like
-sniffrequire sudo. Prefix withsudo. - No output from
airport -s– Your Wi-Fi may be off, or you’re in a location with no networks. Turn on Wi-Fi and try again. - Can’t join a network – Make sure the SSID and password are correct, and that the network is in range. Use
airport -sto confirm the network appears. - Utility missing entirely – In newer macOS versions (Big Sur and later), the airport binary has been removed or moved. Alternatives include using
networksetupor thewdutilcommand.
Comparison with Alternatives
The airport utility is not the only way to manage Wi-Fi from the terminal. Here’s how it stacks up:
- networksetup – A more modern, officially supported tool that can set Wi-Fi power, join networks, and view IP config. It’s less granular for signal scanning.
- wdutil – Another private tool that provides wireless diagnostics, but it’s not for everyday connections.
- Wi-Fi menu bar – The graphical interface is easier for casual users but can’t be scripted.
For most users, networksetup is a safer bet because it’s officially documented. However, airport still has the unique -s scan feature that many find invaluable.
Safety and Limitations
The airport utility is safe to use for reading information, but be careful with -sniff because it captures network traffic, which could raise privacy concerns if used on networks you don’t own. Also, the utility is unofficial, so Apple may change or remove it without notice. Don’t rely on it for critical automation in production environments. For scripting, consider using networksetup or the CoreWLAN framework in Swift.
Frequently Asked Questions
Is the airport command still available in macOS Monterey or Ventura?
In many versions after Catalina, the binary is still present but hidden. You can check by running the full path. If it’s not there, use networksetup instead.
Can I use airport to connect to a hidden network?
Yes, you can specify the SSID and password with airport --join even for hidden networks, but you must know the exact SSID.
What does RSSI mean in the airport scan output?
RSSI is the received signal strength in dBm. Values closer to 0 are stronger. For example, -40 is excellent, -70 is weak.
How do I fix “airport: command not found�?
Create the symlink as described above, or use the full path. If the file doesn’t exist, your macOS version has removed it; switch to networksetup.
Is it legal to sniff Wi-Fi with airport?
Packet sniffing is legal for network troubleshooting on networks you own or have permission to monitor. Using it on others’ networks may violate laws and terms of service.
Can I use airport to create a hotspot?
No, the airport utility doesn’t create hotspots. Use macOS Internet Sharing in System Settings or the networksetup command.
Related
Formula used
in rssi | Signal strength (dBm) | dBm | -50 | -100 in freq | Frequency (GHz) | GHz | 5 | 0 out dist | Approx. distance (m) | m | 10 ^ ((27.55 - (20 * log10(freq * 1000)) + abs(rssi)) / 20) | 1
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.