Can't access localhost any more (MacOS Mojave)

Hi - I wonder if you can help me.

I’ve been using Hugo to create my website, and it’s been working fine up till now. But I had to restart my Mac to install an update, and now when I go to view my development site, it can’t find localhost. The site is being generated OK, because if I go to, then the site is there - but obviously all the links and references have been generated with localhost, so the site doesn’t work properly.

Do you have any suggestions how to remedy?

Terminal - starting hugo server -D


Not 100% sure what the problem is.

Are you saying that when hugo server is running, if you visit http://localhost:1313/ then you get an error, but if you visit then you get a working (but broken) site?

(I’m also running Mojave - 10.14.6 and Hugo 0.56, and it’s working fine.)

Hi Dan - thanks for your reply. Yes, that’s correct. The server is running, but Safari says it can’t find localhost. But the site is running on, although it’s broken.

Before I restarted my Mac, it was working fine.

I’ve solved my problem - it was a corrupted /etc/hosts file, which meant that it wasn’t looking up localhost.

I created a new /etc/hosts file, and everything is working fine now.