I recently upgraded my work laptop to Macbook M1 Pro max and during the setup of Hugo for mywebsite it has trouble running Hugo binary on my new m1 macbook.
So is it possible to run hugo binaries on Mac M1 or do i need to build the binary from source on my new M1 macbook?
One thing you usually have to do on macOS when pulling a binary from the Hugo repo is to whitelist it. I’m using an Intel Mac, but assume it’s the same procedure on Apple Silicon. (The following assumes you don’t have Hugo otherwise installed via a package manager such as Homebrew.)
Open the Security & Privacy section of System Preferences.
Go to the General tab. Keep this open while you go to the next step.
Download the binary and extract it to your system PATH. Make sure you’re replacing your existing Hugo binary. (If necessary, consult the Hugo installation documentation.)
Open a Terminal window and enter hugo version. This will fail with a security warning because you haven’t yet whitelisted the new binary. Cancel out from the warning but keep the Terminal window open.
Back in the System Preferences window, click the lock icon at the bottom and enter your admin password so you can make changes. This will “de-gray” the radio buttons under Allow apps downloaded from, and you’ll see the Hugo binary mentioned as something you can give permission to run (i.e., whitelist).
Click the button to allow Hugo to run. (You can now close the System Preferences window.)
Back in the Terminal window, once again enter hugo version. You’ll get another dialog box asking if it’s OK to run this, so give permission. This will let hugo version run, and you’ll see the usual result — which will confirm that (a.) the whitelisting worked and (b.) the Hugo version you’re running is, indeed, the one you just obtained.
This sounds like a lot of trouble but, in fact, takes only a few moments once you’ve done it a couple of times and are familiar with the procedure. It avoids the wait for a package manager to get the latest Hugo version.
I prefer installing with binary rather then homebrew so i downloaded hugo_0.101.0_macOS-ARM64.tar.gz and changed the mode to make it executable and it worked.