
When a website will not load or your Mac seems disconnected, Terminal’s ping and traceroute commands can help identify where the problem is. ping tests whether a destination responds over the network, while traceroute shows the network hops between your Mac and that destination.
Quick Answer
- Open Terminal from Applications > Utilities.
- Test a destination with
ping:
bash
ping -c 4 example.com
- Stop a continuous
pingtest by pressing Control-C. - Trace the route to the destination with:
bash
traceroute example.com
- Read the results carefully. Successful replies indicate that the tested destination is reachable. Timeouts can indicate filtering, congestion, or a connectivity problem—but a timeout does not always mean your internet connection is broken.
These commands do not change network settings or delete files, so no reversal is needed. They only send network test traffic and display the results.
What ping and traceroute Test
What ping does
ping sends small test packets to a host and waits for replies. The results can show:
- Whether the destination responds
- How long the round trip takes
- Whether any packets were lost
A ping test measures connectivity to the specific host you enter. It does not prove that every website or service is working.
What traceroute does
traceroute identifies the network devices, called hops, that traffic passes through on its way to a destination. These hops may include your router, your internet provider’s equipment, and other routing devices.
A trace can help show whether a connection problem appears:
- On your local network
- Near your internet provider
- Farther along the route
- At the destination or its network
Some routers do not respond to traceroute requests. As a result, asterisks or timeouts in the middle of a trace are not automatically evidence of a failure.
Before You Begin
Make sure your Mac is connected to the network you want to test. If you are troubleshooting Wi-Fi, stay connected to Wi-Fi while testing. If possible, test more than one destination so you can distinguish a problem with one website from a broader connectivity issue.
Do not paste commands from an unfamiliar source into Terminal. The commands in this guide are read-only network tests, but other Terminal commands can change settings or remove data.
Test a Connection with ping
1. Open Terminal
Open Finder, select Applications in the sidebar, open Utilities, and then double-click Terminal.
You can also press Command-Space, type Terminal, and press Return.
2. Send four test packets
The following command sends four test packets to example.com and then stops automatically:
ping -c 4 example.com
-c 4 tells ping to send four packets instead of continuing indefinitely. Replace example.com with the hostname you want to test, such as a website you are having trouble reaching.
A successful test generally displays a reply for each packet, followed by summary information. The summary can include the number of packets transmitted and received, packet loss, and round-trip times.
Because ping only displays results, it does not change your Mac’s network configuration. You do not need to undo anything after running it.

3. Stop a continuous test
If you omit the count, ping continues until you stop it:
ping example.com
To stop the command, press Control-C. This ends the test and returns you to the Terminal prompt. It does not disconnect your Mac or disable networking.
If you accidentally start a continuous test, press Control-C rather than closing Terminal. Closing the window is not necessary and could discard other information displayed in that session.
4. Test a numeric IP address
You can also test an IP address directly:
ping -c 4 1.1.1.1
This bypasses the need to resolve a hostname for that particular command. Comparing a hostname test with an IP-address test can help separate a general connection problem from a name-resolution problem.
For example:
ping -c 4 example.com
ping -c 4 1.1.1.1
If the IP-address test succeeds but the hostname test fails, DNS resolution may be involved. DNS translates names such as example.com into IP addresses. For additional Terminal-based DNS checks, see How to Check DNS Settings and DNS Resolution in Terminal on a Mac.
Understand ping Results
Replies and response times
A reply confirms that the destination responded to a test packet. The time value indicates how long the request took to travel to the destination and back. Higher times can indicate a slower or congested path, but a single high result is not enough to diagnose a problem.
Compare several replies rather than focusing on one number.
Packet loss
Packet loss means that some test packets did not receive replies. Occasional loss can result from filtering or temporary congestion. Consistent loss across repeated tests is more significant, especially if applications also fail.
A destination can block or limit ping while still serving web pages normally. For that reason, packet loss from one host does not prove that your Mac is offline.
“Unknown host” or name-resolution errors
If Terminal reports that it cannot resolve the host name, the command did not reach the intended destination. Check the spelling and test an IP address. If the IP address works but the hostname does not, investigate DNS settings or resolution.
“Request timeout” messages
A timeout means that no reply arrived within the expected period. The destination may be offline, busy, configured not to answer, or separated from your Mac by a device that filters the test traffic.
Test another known destination before concluding that your internet connection is unavailable.
Trace the Network Route with traceroute
1. Run a route trace
The following command traces the route to example.com:
traceroute example.com
traceroute sends probes with increasing time-to-live values so it can identify each routing hop along the path. The output usually lists hop numbers, hostnames or IP addresses, and response times.
This command only gathers information. It does not alter routing, DNS settings, or other network configuration, so there is no reversal step.

2. Trace an IP address
To avoid relying on hostname resolution for the destination, use an IP address:
traceroute 1.1.1.1
If the hostname trace fails before displaying a route but the IP-address trace proceeds, DNS may be the relevant issue. If both fail at the same point, the problem may involve the local network, your provider, the destination, or filtering along the route.
3. Stop a trace if necessary
A trace can take time, especially when one or more hops do not answer. Stop it by pressing Control-C:
traceroute example.com
Press Control-C once to return to the prompt. Stopping the trace does not change your network connection or interrupt other applications.
Read traceroute Output
Hop numbers
The first column numbers the hops in order. Early hops often represent devices close to your Mac, such as your local router. Later hops represent networks farther away.
The exact names and addresses vary by network and destination. Do not assume that every listed hop belongs to your internet provider.
Asterisks
A line containing * indicates that a probe did not receive a response within the waiting period. This can happen because a router:
- Does not respond to traceroute probes
- Gives these probes a low priority
- Filters them while forwarding normal traffic
Asterisks on one line do not necessarily indicate a broken route. If later hops respond, traffic may still be passing through successfully.
A trace that stops responding
If responses stop and never resume, the trace identifies a point worth investigating, but it does not prove that the last responding hop caused the problem. A router may simply stop answering traceroute while continuing to forward traffic.
Run the trace more than once and compare it with a ping test to the final destination. Also test a different destination to see whether the behavior is specific to one route.

Use the Results to Narrow the Problem
Run both commands against more than one destination:
ping -c 4 example.com
traceroute example.com
ping -c 4 1.1.1.1
traceroute 1.1.1.1
These tests do not modify your Mac. They create network traffic, so avoid running large numbers of continuous tests for extended periods.
Use the following patterns as practical clues:
- Both destinations fail: Check whether your Mac is connected to Wi-Fi or Ethernet. Restarting the router or reconnecting to the network may help.
- An IP address responds, but a hostname does not: Investigate DNS resolution.
- One destination fails while another responds: The issue may be specific to the destination or its route.
pingworks, but a website does not open: The website, browser, DNS, HTTPS connection, or another service may be involved.pingdoes not test every part of web access.- The trace contains asterisks, but the destination responds: Intermediate devices may be filtering traceroute replies. This alone is not a problem.
- Early hops fail consistently and other network activity also fails: Your local network connection or router may need attention.
For a broader view of network activity, see How to See Which Apps Are Using the Network on a Mac Using Terminal.
Troubleshooting
Terminal says command not found
macOS normally includes both ping and traceroute. If Terminal cannot find one, check that you typed the command correctly and that you did not include extra punctuation or formatting characters.
The destination does not answer ping
Try another destination and test the same destination with a web browser. Many hosts intentionally do not answer ping, so use the result as one clue rather than a final diagnosis.
traceroute appears to hang
Wait briefly for the command to continue. A nonresponsive hop can delay output. Press Control-C if you want to stop the trace. No configuration needs to be restored afterward.
Results change between runs
Network paths can change, and temporary congestion can affect response times. Run the same test several times and look for a consistent pattern. Test while your connection is experiencing the problem, not only after it has recovered.
The problem may be DNS
When names fail but numeric IP addresses work, check your DNS configuration and resolution behavior. A DNS problem can prevent applications from finding services even when the underlying internet connection is available.
You need more evidence about a local network problem
Test from another device on the same network. If multiple devices have the same issue, the router or internet service may be involved. If only your Mac is affected, focus on its connection, network settings, or software.
Frequently Asked Questions
Does a successful ping prove that the internet is working?
No. It proves that the tested host responded to ping. Web access can still fail because of DNS, browser issues, HTTPS problems, service outages, or firewall and filtering rules.
What is the difference between ping and traceroute?
ping tests whether a destination responds and measures round-trip time. traceroute displays the intermediate hops used to reach that destination. They answer different questions and are most useful together.
Can ping or traceroute damage my Mac?
These commands do not modify files or network settings. They send test traffic and display replies. Stop a running command with Control-C when you are finished.
Why does traceroute show * * *?
A hop may be configured not to answer traceroute probes or may prioritize other traffic. Asterisks do not automatically mean that the connection has failed.
Should I use a website’s name or its IP address?
Use both when troubleshooting. A hostname tests name resolution as well as connectivity. An IP address can help determine whether DNS is part of the problem.
Final Thoughts
ping helps test whether a destination responds, while traceroute shows the path traffic takes to reach it. Use both commands against more than one destination, interpret timeouts cautiously, and compare the results with what your browser and other devices are experiencing.