Skip to content

How to resolve 'Request timeout for icmp_seq' when ping localhost or ping 127.0.0.1

1. Purpose

In this post, I will demonstrate how to resolve the following exception when using the ping command on macOS.

ping
~ ping localhost
PING localhost (127.0.0.1): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
~ ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1

2. Environment

  • macOS

3. The Debug

3.1 Check your /etc/hosts

Make sure you have the following line in your /etc/hosts file:

/etc/hosts
127.0.0.1 localhost

3.2 Check the nslookup result

Run the following command to check the nslookup result:

nslookup
$ nslookup localhost

4. The Solution

4.1 Check your proxy

If you are using a proxy on your machine, try disabling it to see if it resolves the issue.

4.2 Check your network firewall settings

  1. Go to System PreferencesSecurityFirewall.
  2. Click Firewall Options.
  3. Uncheck Block all incoming connections.
  4. Ensure that Stealth Mode is turned off.

5. Summary

In this post, I demonstrated how to resolve the ping localhost or ping 127.0.0.1 timeout issue on macOS. The key steps involve checking your /etc/hosts file, ensuring that your proxy is not interfering, and verifying your firewall settings. By following these steps, you should be able to resolve the Request timeout for icmp_seq error.

Final Words + More Resources

My intention with this article was to help others who might be considering solving such a problem. So I hope that’s been the case here. If you still have any questions, don’t hesitate to ask me by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!