The beauty of the Mac that my Windows-tolerating, Mac-non-understanding friends don’t see is that it runs Unix, and that means it can run everything the entire web is built on and the tools that are used to develop the entire web.
Hugo is no exception. You’re probably not going to want to run production sites from your Mac, but you can get a lot of development work and testing done by running Hugo on a Mac and hacking away at your sites from your local network.
Installing Hugo on macOS is relatively simple using Homebrew.
Homebrew’s marketing technique leaves a bit to be desired:
Homebrew installs the stuff you need that Apple (or your Linux system) didn’t.
Less than convincing, yes, but Homebrew is in fact quite useful. Once Homebrew is installed, getting Hugo on your Mac is just a matter of typing the following in the command line:
brew install hugo
Hey, presto, you‘re a Hugonaut.
The Hugo Quick Start will get you up and running and creating new Hugo sites, but if you want to run the Hugo server on your Mac but edit your site from elsewhere on your local network (from your iPad, for example), it’s not immediately clear how this is done.
The Hugo local server binds to the Mac’s loopback address – 127.0.0.1 – and that’s not going to help you reach your dev site from other devices on your network. In order to access the site your Hugo server is running on your Mac from the browser on a different machine on the local network, you’ll need to bind the site to your Mac’s LAN IP address instead.
Assuming your router has assigned an IP of 192.168.1.3 to your Mac (which is what my Mac is at the moment), simply type the following to start the Hugo server on the Mac instead of the usual “hugo server” command:
hugo server --bind=192.168.1.3 --baseURL=http://192.168.1.3:1313
Once you’ve done this, you can just fire up a browser on any device on your LAN and cruise over to 192.168.1.3:1313 and see your changes real-time.