How to Check the Current Network on macOS from the Terminal (Wi-Fi Name, 2.4GHz or 5GHz, IP, DNS)

Code-editor style cover with macOS networksetup, route and ipconfig commands for checking the current network

You’re in Terminal and want to know which network your Mac is on. This guide has a command for each question: which interface is active, what the Wi-Fi name is, whether you’re on 2.4GHz or 5GHz, what your IP address is, and where DNS points. The commands are built into macOS, so you don’t need to install anything. It is written for current macOS on Apple Silicon Macs (M1 and later), with notes for Intel Macs. On newer macOS versions, Apple hides some Wi-Fi details from Terminal, and I note each case below.

Apple Silicon (M1 and later) or Intel?

The commands are the same on both chips. What changes the result is the macOS version, not the processor. To check your Mac, open the Apple menu, choose About This Mac, and look at Chip (Apple M1 or later) or Processor (Intel). In Terminal, uname -m prints arm64 on Apple Silicon and x86_64 on Intel.

  • Apple Silicon on the latest macOS: use the commands in this guide. networksetup -getairportnetwork may not show the network name; use system_profiler or wdutil from Step 3 and the band section instead.
  • Intel Macs: they can run only up to a certain macOS release, so you may be on an older version. The same commands apply. On older macOS versions, a tool called airport -I also showed the band and channel, but Apple has reportedly removed it in recent versions, so don’t depend on it. I haven’t tested any of this on an Intel Mac.

Quick answers

You want Command
Interface in use route -n get default
Your IP address ipconfig getifaddr en0
Wi-Fi name (SSID) networksetup -getairportnetwork en0
2.4GHz or 5GHz, channel, signal system_profiler SPAirPortDataType
Router and subnet networksetup -getinfo Wi-Fi
DNS servers scutil --dns

en0 is usually Wi-Fi on a laptop, but not always. Step 1 shows you how to check.

Step 1: Find your interface names

networksetup -listallhardwareports

This lists each hardware port with its device name, for example “Hardware Port: Wi-Fi, Device: en0”. Use the device name that goes with Wi-Fi in the commands below. On a Mac mini or desktop, Wi-Fi is often not en0, and Ethernet takes that name.

Step 2: See which interface is carrying your traffic

route -n get default

The line starting interface: is the interface your internet traffic uses, and gateway: is your router. If you are on Ethernet and Wi-Fi at once, this shows which one wins. You can also see the priority list:

networksetup -listnetworkserviceorder

The top service is tried first.

Step 3: Get the Wi-Fi network name

networksetup -getairportnetwork en0

When it works, it prints Current Wi-Fi Network: YourNetworkName.

If it says you are not associated with a Wi-Fi network while you are online: newer macOS versions are reported to hide the network name from this command. It’s a privacy change, and the command is not broken. Use one of these instead:

wdutil info

wdutil info prints the full Wi-Fi details, including the network name. Per SS64 it shows what the Wi-Fi Info utility shows. On newer macOS it may require sudo to show the SSID; I haven’t verified this, so try both. A fallback that needs no Terminal commands is holding Option and clicking the Wi-Fi icon in the menu bar, which shows the network name and details.

Step 4: Check whether you are on 2.4GHz or 5GHz

If your router offers two Wi-Fi bands, these show which one your Mac is using. All three work on Apple Silicon and Intel Macs running a recent macOS.

Option-click the Wi-Fi icon. Hold Option and click the Wi-Fi icon in the menu bar. It shows the network name, BSSID and the channel with its band and width, for example “36 (5 GHz, 80 MHz)”, plus signal strength (RSSI), noise and transmit rate.

system_profiler (no sudo):

system_profiler SPAirPortDataType

Look under “Current Network Information” for the channel with its band, PHY mode, security and signal. The output is long, so you can narrow it:

system_profiler SPAirPortDataType | grep -A 12 "Current Network Information"

On newer macOS the network name may show as redacted.

wdutil (needs sudo):

sudo wdutil info

The Wi-Fi section lists the SSID, BSSID, channel and band, width, RSSI, noise, transmit rate, PHY mode and country code. It is the most detailed option.

How to read the band:

  • Channels 1 to 14 are 2.4GHz. It reaches further but is slower and more crowded.
  • Channels 36 and above are 5GHz. It is faster but has a shorter range.
  • 6GHz channels (Wi-Fi 6E and Wi-Fi 7, on Macs and routers that support them) reuse low numbers, so read the band label and not the channel number alone.

If both bands share one network name: many routers use the same name for 2.4GHz and 5GHz. Then compare the BSSID, the router’s radio address. Each band has its own, so it tells you which radio you joined. Or use the channel number above.

Step 5: Get your IP address

ipconfig getifaddr en0

This prints your local IP address, or nothing if that interface isn’t connected. For full details on Wi-Fi, including router and subnet mask:

networksetup -getinfo Wi-Fi

Use the service name from networksetup -listallnetworkservices, such as Ethernet, if you’re not on Wi-Fi. This shows your local (private) address only. For your public address, you need an external service, for example curl ifconfig.me. Be aware that this sends a request to a third-party site.

Step 6: Check DNS

scutil --dns

This prints the resolver configuration macOS is using, including nameservers. For just one service:

networksetup -getdnsservers Wi-Fi

If it prints “There aren’t any DNS Servers set”, macOS is using the ones from your router.

Step 7: Check that you can reach something

scutil -r example.com

It reports “Reachable” or “Not Reachable” from the current network configuration. It doesn’t test whether the site is up. For that, use ping -c 3 example.com.

One small script

Save as netinfo.sh, with the Wi-Fi device on en0 (change it if Step 1 shows otherwise):

#!/bin/bash
echo "Active interface: $(route -n get default 2>/dev/null | awk '/interface:/{print $2}')"
echo "Router: $(route -n get default 2>/dev/null | awk '/gateway:/{print $2}')"
echo "IP (en0): $(ipconfig getifaddr en0)"
networksetup -getairportnetwork en0

Run it with bash netinfo.sh.

FAQ

Do I need sudo? Not for most of these. wdutil info may need it for the network name on newer macOS.

Is it different on M1, M2 or M3 Macs than on Intel? The commands are the same. Differences come from the macOS version.

Why is en0 empty? That interface isn’t connected, or it isn’t the one you think. Run Step 1.

How do I know if I’m on 5GHz? Use Step 4. A channel of 36 or higher with a 5 GHz label means 5GHz.

Does this work on Linux? No. These are macOS tools.

Sources: SS64 pages for networksetup, wdutil and scutil.

Leave a Reply