The ping command is a fundamental network diagnostic tool used to test the reachability of another device on an IP network. When you ping an IP address, your Mac sends a tiny packet of data (an ICMP Echo Request) to that destination and waits for a reply. It is the digital equivalent of shouting “Are you there?” across a room and waiting to hear “Yes, I’m here!”
You can use this tool to determine if your internet connection is working, to verify that a specific website’s server is online, or to check if a local network printer is properly connected to your Wi-Fi. While macOS features a sleek graphical interface, the fastest and most reliable way to perform a ping test is through the Terminal.
How to Ping an IP Address or Website
The ping utility is built directly into the core of macOS and requires no special installation.
- Click the Spotlight Search icon (the magnifying glass) in the top-right corner of your menu bar, or press Command (⌘) + Spacebar.
- Type
Terminaland press Enter to open the command line application. - Type the word
pingfollowed by a single space, and then type the IP address (or website domain name) you wish to test. For example:- To test a local router:
ping 192.168.1.1 - To test an external website:
ping google.com - To test a public DNS server:
ping 8.8.8.8
- To test a local router:
- Press Enter to execute the command.
The terminal will immediately begin outputting data line by line. Each line represents one packet of data sent and returned, displaying the exact time it took (in milliseconds) for the round trip.
How to Stop the Ping Command
Unlike Windows, which typically sends only four packets and then stops automatically, macOS is designed to run the ping command continuously forever until you explicitly tell it to stop.
If you let it run, it will eventually flood your terminal window.
- To stop the test and return to your normal command prompt, press and hold the Control (Ctrl) key and press C.
Upon stopping, the terminal will print a final summary showing how many packets were transmitted, how many were successfully received, and the percentage of packet loss. A 0% packet loss indicates a perfect, stable connection.
How to Ping a Specific Number of Times
If you prefer the Windows-style behaviour where the test runs a few times and stops itself automatically, you can use the -c (count) flag when initiating the command.
- In the terminal, type
ping -c 4followed by your target address. - For example:
ping -c 4 192.168.1.1
This command instructs your Mac to send exactly four packets, wait for the replies, print the summary, and then automatically exit the utility without requiring you to use the Ctrl+C shortcut.