I have followed this guide to set-up Apache on High Sierra: https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/

I used it to set it up on Sierra.

But when I go to http://localhost I get "Hmm. We’re having trouble finding the site "

A suggestion on this similar question: localhost on macOS High Sierra. Which I've tried, but still cannot connect to localhost:(

I tried install mamp and reinstall it then install ampps but still that problem , I write in terminal sudo apachectl start then sudo apachectl stop and again start but nothing changes.

Please help me i tried to solve problems for 2 weeks ago :(

1 Answer 1


You need to do some troubleshooting to find out what's wrong. That error message ("Hmm. We’re having trouble finding the site.") sounds like Firefox having trouble looking up the address for the name "localhost", which is really weird because "localhost" is pretty much built into the operating system. So, first verify that "localhost" is being properly resolved with the command dscacheutil -q host -a name localhost -- it should look like this:

$ dscacheutil -q host -a name localhost
name: localhost
ipv6_address: ::1
ipv6_address: fe80:1::1

name: localhost

If the response doesn't list at least the addresses "::1" and "", something is terribly wrong. (It's ok if it lists additional addresses like "fe80:1::1".) This has nothing to do with Apache. If this is the problem, check your /etc/hosts file; it should contain at least this:

# Host Database
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##       localhost broadcasthost
::1             localhost 

Also, try bypassing the name lookup by trying to reach "" and "http://[::1]/". If those work, Apache is running and "localhost" lookup is the reason you're getting errors.

If bypassing the name lookup doesn't work, check to see whether Apache ("httpd") is running with the command ps -ax | grep '[h]ttpd'

$ ps -ax | grep '[h]ttpd'
48917 ??         0:00.62 /usr/sbin/httpd -D FOREGROUND
48924 ??         0:00.02 /usr/sbin/httpd -D FOREGROUND
48927 ??         0:00.01 /usr/sbin/httpd -D FOREGROUND

If there are no "httpd" processes listed, Apache is not running, and you'll need to troubleshoot further to find out whether it's not starting at all, or starting and getting a fatal error. If it is running, make sure it's listening for network connections with sudo lsof -a -c httpd -i -sTCP:LISTEN

$ sudo lsof -a -c httpd -i -sTCP:LISTEN
httpd   48917 root    4u  IPv6 0x3c39418bc7b0ab99      0t0  TCP *:http (LISTEN)
httpd   48924 _www    4u  IPv6 0x3c39418bc7b0ab99      0t0  TCP *:http (LISTEN)
httpd   48927 _www    4u  IPv6 0x3c39418bc7b0ab99      0t0  TCP *:http (LISTEN)

In the above, all three "httpd" processes are listening for TCP connections on "*:http" -- that is, port 80 (http) on all of this computer's IP addresses. If it lists something else, Apache is running, but the configuration is weird.

Note: none of the above will solve the problem, it's all directed toward finding out what the actual problem is. Once you have a better idea what the problem is, then you can try to figure out how to fix it.

  • When i write dscacheutil -q host -a name localhost in terminal , i don't have any response i stop apache then start it but no response :( Feb 11, 2019 at 22:40
  • @manalal-harbi Then don't worry about Apache, it's not related to resolving the name "localhost". What's in /etc/hosts? Feb 11, 2019 at 22:52
  • GNU nano 2.0.6 File: /etc/hosts ##\n# Host Database\n#\n# localhost is used to configure the loopback interface$ That is exist in file. Feb 12, 2019 at 8:53
  • @manalal-harbi In that case, your /etc/hosts is badly messed up. You can copy what I listed in the answer to correct it (note: the characters between the addresses and names are tab characters). Then try the dscacheutil command again to make sure it works. Feb 12, 2019 at 18:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .