Properly installing Hugo using homebrew


I’m new to discord and using home-brew and all so I hope I’m posting this with all information you need. Please let me know otherwise.

I am trying to install Hugo on Mac using homebrew. When I installed it, it’s located in /opt/homebrew/bin/hugo, and I can’t run the program. For your information, I use MacBook Pro 13-inch, M1, 2020, with macOS of Monterey version 12.5.1.

Below is detailed walk-through of what I did.
I followed the instruction provided in below webpage:

First, I visited the Homebrew website and copied the code into my terminal as below.

/bin/bash -c "$(curl -fsSL"

When it ran it, it produced the following warning:

Warning: /opt/homebrew/bin is not in your PATH.

Instructions on how to configure your shell for Homebrew

can be found in the ‘Next steps’ section below.

I googled that exact warning I showed you above. Someone recommended to type in the two lines of code in terminals so that’s what I did. Here are the two codes:

export PATH=/opt/homebrew/bin:$PATH

followed by

source ~/.zshrc

And then I also saw another person pointing out how there’s the instruction of ‘Next Steps’ that we are neglecting. The following is the Next Step which was printed out in my terminal after the warning sign. :

  • Run these two commands in your terminal to add Homebrew to your PATH:
    echo ‘eval “$(/opt/homebrew/bin/brew shellenv)”’ >> /Users/u1317537/.zprofile
    eval “$(/opt/homebrew/bin/brew shellenv)”

So I ran these two lines of code as below.:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/u1317537/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

And then, I proceeded with the following code to install hugo.:

brew install hugo

And I tried to check the directory where hugo was installed by typing the following.:

which hugo

What I got out from it is /opt/homebrew/bin/hugo. When I execute the below code,


I get the following error:

Error: Unable to locate config file or config directory. Perhaps you need to create a new site.
Run hugo help new for details.

Total in 0 ms

I think the hugo was supposed to have been installed in local, but it’s not. Could you please help me with fixing the issue? Thank you!

1) Close all terminals
2) Open new terminal
3) Type hugo version

What’s the output?

Thank you for your help! Here’s the output. :

hugo v0.101.0+extended darwin/arm64 BuildDate=unknown

Then Hugo extended is properly installed. What’s the problem?

I’m sorry about being unclear.

Currently, my Hugo is located here: /opt/homebrew/bin/

Whereas according to the YouTube video which can be found in the website I provided (, Hugo should be installed in /usr/local/bin.

That is, I have /opt/homebrew, instead of /u1317537/local. Is that be okay? Will that cause any problem in the future because hugo is not located in /usr/local???

If hugo executes then it doesn’t matter where it’s located with respect to building your site.

And that looks like the correct location when using homebrew to update versions in the future.

Another test:

  1. Close all terminals
  2. Open new terminal
  3. Type brew upgrade hugo

What’s the output?

Thank you so much for prompt response! So I actually dried using hugo server command line and it worked, just like you said! Thank you. :slight_smile:

Since you have also provided another test, I did what you asked me to do. The output was the following sentence.:

Warning: hugo 0.101.0 already installed

Excellent. That means brew likes where it is.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.