sodcalculator

10 Tech How-To

How to Ping from MacBook: Terminal Guide

Guide 10-43671 · Updated · Step by step

Pinging from a MacBook sends a series of ICMP echo requests to a target IP address or hostname, then reports the response time and packet loss. This built-in network diagnostic tool helps you check if a device is reachable, measure latency, and verify your internet connection. You only need the Terminal app, which comes preinstalled on every Mac, and the address you want to test.

What You’ll Need

  • A MacBook running macOS (any recent version)
  • The IP address or hostname of the device you want to ping (e.g., 8.8.8.8, google.com, or a local printer’s IP)
  • Optional: Administrator access for advanced ping options (not required for basic pings)

Step-by-Step

  1. Open Terminal. Click the Launchpad icon in your Dock (or press F4), type “Terminal” in the search bar, and click the Terminal app. Alternatively, open Finder, go to Applications → Utilities, and double-click Terminal.
  2. Understand the basic command. The ping command follows this structure: ping [options] destination. The destination can be an IP address (like 192.168.1.1) or a domain name (like google.com).
  3. Run a standard ping. Type ping google.com and press Return. You’ll see lines like 64 bytes from 142.250.190.78: icmp_seq=0 ttl=115 time=12.3 ms appearing continuously.
  4. Stop the ping. By default, ping runs indefinitely. Press Control + C to stop it. Terminal will display a summary showing packets transmitted, received, packet loss percentage, and min/avg/max time.
  5. Ping a specific number of times. If you want ping to stop automatically, use the -c flag followed by a number. For example, ping -c 5 google.com sends exactly 5 packets and then stops.
  6. Ping an IP address. To test a local device, type ping 192.168.1.1 (replace with your router’s IP or another device’s address). This works the same way as pinging a domain.
  7. Use continuous ping for monitoring. For a real-time view of network stability, run ping -i 1 google.com to send one packet every second indefinitely. Press Control+C when done.
  8. Check the output. Each successful reply shows the response time in milliseconds (ms). Lower times mean faster connections. A “Request timeout” message means the packet didn’t get a reply.
  9. Read the summary. When you stop the ping, look at the statistics: “packet loss” should be 0% for a healthy connection, and the average time gives you a baseline latency figure.

Common Mistakes

  • Forgetting to stop the ping. Many users close Terminal while ping is still running, which doesn’t show the summary. Always press Control+C first.
  • Using the wrong flag syntax. The flag is -c (lowercase) for count, not -C. macOS is case-sensitive with flags.
  • Pinging with a trailing slash. Type ping google.com, not ping google.com/. The slash causes a DNS lookup failure.
  • Confusing ping with traceroute. Ping tests reachability; traceroute (traceroute command) shows the path packets take. They serve different purposes.
  • Ignoring the packet loss column. Even if some pings succeed, any packet loss indicates network problems worth investigating.

Tips

  • Use a public DNS server for internet tests. Pinging 8.8.8.8 (Google DNS) or 1.1.1.1 (Cloudflare) tests your internet connection without relying on a domain name lookup.
  • Ping your router first. To isolate network issues, ping your router’s IP (usually 192.168.1.1 or 192.168.0.1). If that works but pinging external sites fails, the problem is beyond your local network.
  • Use the -t flag for timestamps. Adding -t to your ping command shows the time of day with each reply, useful for correlating drops with specific moments.
  • Set a timeout. The -W flag (in milliseconds) controls how long to wait for a reply. For example, ping -W 1000 google.com waits 1 second before declaring a timeout.
  • Combine flags. You can combine options: ping -c 10 -i 0.5 google.com sends 10 pings at half-second intervals.
  • Note that macOS ping uses seconds for -i. Unlike some Linux versions, macOS doesn’t allow intervals below 0.2 seconds without root privileges.

Troubleshooting

  • “ping: cannot resolve google.com: Unknown host” — This means DNS isn’t working. Try pinging an IP address directly (like 8.8.8.8). If that works, your DNS settings are the problem. Check System Settings → Network → your connection → Details → DNS.
  • “Request timeout for icmp_seq” — The destination isn’t responding. Check if the device is powered on, connected to the network, and that you have the correct IP address. Firewalls on the target device may also block ICMP requests.
  • 100% packet loss to your router — This indicates a local network issue. Restart your router and MacBook, check Wi-Fi or Ethernet cables, and verify you’re connected to the correct network.
  • Ping works for IPs but not domain names — DNS resolution is failing. Try flushing DNS with sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder in Terminal, then test again.
  • “Operation not permitted” error — macOS may be blocking ping due to network permissions. Check System Settings → Privacy & Security → Local Network and ensure Terminal is allowed.
  • Ping shows high latency (100+ ms) — This could be normal for distant servers. Test with a local device to compare. If local pings are fast but external ones are slow, your ISP or routing is the issue.
  • Terminal says “command not found” — This is extremely rare on macOS. Ensure you’re typing ping (lowercase) and not something else. If it persists, your shell PATH may be broken; try /sbin/ping instead.

Frequently Asked Questions

How do I stop a ping on Mac?

Press Control + C while the ping is running. This stops the process and displays the final statistics summary.

Why does my Mac ping keep running?

By default, the macOS ping command runs indefinitely until you stop it. Use the -c flag (e.g., ping -c 10 google.com) to limit the number of pings automatically.

Can I ping a port on Mac?

No, the standard ping command uses ICMP protocol and doesn’t test ports. To test a specific port (like 443 for HTTPS), use nc -vz hostname port (Netcat) or telnet hostname port instead.

What does “ttl” mean in ping output?

TTL stands for Time To Live. It’s a counter that decreases by 1 each time the packet passes through a router. When it reaches 0, the packet is discarded. A lower TTL in the reply indicates more hops between you and the destination.

Is high ping always bad?

Not necessarily. Ping times vary by distance and network path. A ping of 30ms to a server across the ocean is excellent, while 30ms to your router might indicate a problem. Compare pings to multiple targets to establish a baseline.

How do I ping an IPv6 address on Mac?

Use the -6 flag: ping -6 ipv6.google.com or ping6 ipv6.google.com. Note that your network must support IPv6 for this to work.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →