Check your Mac's public IP address from Terminal

Find the external IP your router or VPN presents to the internet.

macOSTerminalLow risk
Run the command below — your public IPv4 address prints on one line, e.g. 203.0.113.42.

01Command

Command
$ curl -s https://ifconfig.me && echo

02What it does

Your Mac's local address (System Settings → Wi-Fi → Details) is private; what websites see is the public IP of your router or VPN exit node. Asking an echo service like ifconfig.me returns that address as plain text, and curl -s keeps the output clean. The trailing && echo just adds a newline so the prompt starts on a new line. Behind IPv6, some services return the v6 address — use https://api64.ipify.org explicitly if you want one or the other.

03Risk

RiskLow risk
RequirementsInternet connection required; the address shown is the one your ISP/VPN assigns.
CompatibilitymacOS 10.11 El Capitan – 15 Sequoia
!Warning: Any IP echo service sees your IP and user agent — pick one you trust, or self-host a tiny echo endpoint.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • macOS curl command reference
    SS64 · technical · 2026-09-16
    Evidence: curl -s fetches a URL quietly and prints only the response body, which echo ends with a newline.
  • ifconfig.me — IP echo service
    ifconfig.me · community · 2026-09-16
    Evidence: The service returns the requester's public IP address as plain text.

Last verified: 2026-09-16 · Category: Network

06Related solutions