How to Use ping on Mac: Pinging Websites, Domains, or IP Addresses

Apr 28, 2010 - 5 Comments

Terminal in OS X Ping is an essential utility for network administrators, but it’s also pretty handy to check if websites are online, how your internet connection is working, if you are experiencing lag or packet loss on a network connection, or if a network resource is available.

There are two ways to access ping tools in OS X from any Mac running any version of system software, but we’ll focus primarily on using ping from the command line since it is universal, meaning once you know how to use it on Mac OS X, but you’ll find it in Unix, Linux, and Windows too.

How to Use Ping from Mac OS X Command Line

Here’s how to use it the ping utility in all versions of Mac OS X from the Terminal app command line.

Ping a Destination IP or Domain Until Stopped

The most basic usage of ping will ping a destination until it is manually stopped, meaning there is no limit and no count.

  1. Launch the Terminal, found in the Utilities folder of Applications
  2. Type the following command:
  3. ping

  4. This will ping to repeatedly until you stop the ping command from running by hitting Control+C

Ping an IP / Domain for a Specified Packet Count

Want to send a handful of packets and measure that instead of pinging endlessly until manually stopped? Use the -c flag attached to ping, everything else is the same:

  1. Go back to the command line if you’re not there again
  2. To send a specific number of packets to an address, modify ping syntax to use the -c flag like so:
  3. ping -c 5

  4. Hit return and let ping complete to the destination for the specified packet count before automatically terminating the ping

In that example, -c 5 will send 5 packets to the destination IP.

Note the ping command only works if the Mac is online, and if the server you are pinging is online, and responds to ping requests. Most servers do respond if they’re online, except perhaps the most hardened networks who reject ping for security purposes.

Reading and Understanding Ping Results

An example of ping results may look like the following:
$ ping
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=57 time=23.845 ms
64 bytes from icmp_seq=1 ttl=57 time=22.067 ms
64 bytes from icmp_seq=2 ttl=57 time=18.079 ms
64 bytes from icmp_seq=3 ttl=57 time=23.284 ms
64 bytes from icmp_seq=4 ttl=57 time=23.451 ms
64 bytes from icmp_seq=5 ttl=57 time=21.202 ms
64 bytes from icmp_seq=6 ttl=57 time=22.176 ms
64 bytes from icmp_seq=7 ttl=57 time=21.974 ms
--- ping statistics ---
8 packets transmitted, 8 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 18.079/22.010/23.845/1.703 ms

Each line to the destination represents a packet transission, the time specified in milliseconds at the end is most relevant for testing an internet connection as a high number there indicates there is lag or a connection problem. If there is no response at all, either the server is down, there is a connection problem, it does not respond to ping requests, or it is very slow to respond.

Perhaps next most useful is the “packet loss” number at the end. If packet loss is high, you almost certainly have network issues, because packet loss means that data being sent between you and the server is being lost (the term is quite literal in that sense). Troubleshooting packet loss can be challenging, but it can be the result of a poor internet connection, wi-fi problems, general network problems, a bad connection, a struggling connection, an interfered connection, connection interruptions, or many other potential networking issues.

Using ping to Verify Network Assets & Test Network Latency

I use ping constantly to make sure network servers are available, because it’s a lot faster to ping an IP than to try and connect to it through any number of protocols. It’s also a great way to test internet connections latency, which can be helpful for troubleshooting network issues with wi-fi or wired connections.

For users who do not feel comfortable with the command line, users can turn to the Network Utility app, which is bundled with every version of Mac OS X and provides a simple user friendly interface to ping, as well as a host of other helpful networking utilities.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS X, Tips & Tricks


» Comments RSS Feed

  1. inket says:

    Additional Information:
    “Network” provides a GUI version for Ping and other administration commands. (Traceroute, Lookup, whois etc.)

  2. Bronzit says:

    inket: What he said = easiest way.

  3. […] Note: for whatever reason, when you are setting the IP address manually via the command line the Mac OS X Network Preferences doesn’t necessarily catch up to the changes. Do not be surprised if the Network preference pane is telling you that you “Airport does not have an IP address and cannot connect to the Internet.” when in fact, you do have one and you are online. You can verify that you are connected to the LAN or internet by using the ping command. […]

  4. Brock says:

    Network Utility resolved my issue!

  5. Brian says:

    I find terminal to be much more useful than network utility for this reason: If you are pinging things, odds are something isn’t working right. If it’s not working right, you want to know where the problem is. So I open two terminal windows, one pinging my router and one pinging google. If the same problem exists between my mac and the router that exists between myself and google, i.e. dropped packets or wildly fluctuating ping times, I can focus on the local network. If the connection between my mac and the router is fine then I know either my internet provider’s connection is spotty or a piece of equipment further down the line needs to be reset..but troubleshooting the mac itself at that point would be fruitless.

Leave a Reply


Shop for Apple & Mac Deals on

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates