# How to downgrade hugo to a previous version?

**URL:** <https://discourse.gohugo.io/t/how-to-downgrade-hugo-to-a-previous-version/40388>\
**Category:** support\
**Created:** [September 5, 2022, 8:54pm UTC](https://discourse.gohugo.io/t/how-to-downgrade-hugo-to-a-previous-version/40388 "2022-09-05T20:54:44Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![pitifi9191](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@pitifi9191](https://discourse.gohugo.io/u/pitifi9191)\
**Post date:** [September 5, 2022, 8:54pm UTC](https://discourse.gohugo.io/t/how-to-downgrade-hugo-to-a-previous-version/40388/1 "2022-09-05T20:54:44Z")

</div>

Hi there,

I was on a version 0.99 and made the mistake to upgrade to the latest version.

Now when i run anything hugo i recieve this error

```auto
exit status 128:
        fatal: 'origin' does not appear to be a git repository
        fatal: Could not read from remote repository.
        
        Please make sure you have the correct access rights
        and the repository exists.
hugo: collected modules in 1193 ms
Error: failed to download modules: failed to execute 'go [mod download]': failed to execute binary "go" with args [mod download]: go: github.com/tailwindlabs/heroicons@v1.0.6: reading github.com/tailwindlabs/heroicons/go.mod at revision v1.0.6: git ls-remote -q origin in /var/folders/ck/gvmj2pdn21zbtz8zcncfm5980000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/cache/vcs/ecb0a6aab76ae32954b6d60074dbc4f5721a5fba93cb4db856ab7a22877ce2e7: exit status 128:
        fatal: 'origin' does not appear to be a git repository
        fatal: Could not read from remote repository.
        
        Please make sure you have the correct access rights
        and the repository exists.
 *errors.errorString

```

Now the error is tottally irrelevent as i previosuly find out unless i change the hugo version it will not be solved there have been no change on permissions or anything else.

my previous method of downgrading hugo is not working anymore which was:

1. `brew uninstall hugo`
2. brew install `https://github.com/Homebrew/homebrew-core/blob/553aa577278e74b4d440e3a0ae485bdd73f157f8/Formula/hugo.rb`

As it has been a while since i took the painfull path of downgrading hugo. Does anyone have an idea of a working solution to downgrade hugo to version 0.99

Thanks for taking the time to help

---

<div class="post-metadata">

**Author:** ![fekete-robert](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/fekete-robert/32/13363_2.png) [@fekete-robert](https://discourse.gohugo.io/u/fekete-robert)\
**Post date:** [September 6, 2022, 6:39am UTC](https://discourse.gohugo.io/t/how-to-downgrade-hugo-to-a-previous-version/40388/2 "2022-09-06T06:39:49Z")

</div>

Probably there is a better solution, but this worked for me yesterday:

1. Find a suitable hugo version on the [Hugo releases page](https://github.com/gohugoio/hugo/releases)
2. Download and unpack the appropriate file for your platform to a suitable directory
3. Use that in your commands (for example, use `~/hugo serve`, or add it to the path, or add an alias, …)
4. Since you are on Mac, it will probably complain that it cannot verify the developer of the binary, in this case locate the file in Finder, CTRL+click on it, and click Open to add it to the exceptions.

---

<div class="post-metadata">

**Author:** ![divinerites](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/divinerites/32/12625_2.png) [@divinerites](https://discourse.gohugo.io/u/divinerites)\
**Post date:** [September 6, 2022, 9:09am UTC](https://discourse.gohugo.io/t/how-to-downgrade-hugo-to-a-previous-version/40388/3 "2022-09-06T09:09:40Z")

</div>

> [@pitifi9191](#):
>
> `fatal: 'origin' does not appear to be a git repository`

Are you sure that you `only` upgrade hugo ?

Sounds like your repository changed too.

---

<div class="post-metadata">

**Author:** ![pitifi9191](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@pitifi9191](https://discourse.gohugo.io/u/pitifi9191)\
**Post date:** [September 6, 2022, 10:38am UTC](https://discourse.gohugo.io/t/how-to-downgrade-hugo-to-a-previous-version/40388/4 "2022-09-06T10:38:21Z")

</div>

Hi @divinerites

This is related to hugo version upgrade had the smae issue in past where it show randon messages but once i downgrade or upgrade from a specific version everthing works. So to answer your question there is no change at all in the repository.

The hugo version downgrade isnt that easy for example running `brew install go@1.18` instal golang vesion 1.18 but the same technique doesnt work for hugo

```auto
brew install hugo@0.102.0
Warning: No available formula with the name "hugo@0.102.0".
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

```

So i dont know what the issue is maybe the hugo versions with the homebrew doesnt matchup?

i can install any brew package to a specific version including golang but hugo fails.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [September 7, 2022, 9:36pm UTC](https://discourse.gohugo.io/t/how-to-downgrade-hugo-to-a-previous-version/40388/5 "2022-09-07T21:36:01Z")

</div>

#### TLDR: Use something other than Homebrew

> [@pitifi9191](#):
>
> i can install any brew package to a specific version

Only a few of the Homebrew packages have version-specific formulae. See [this list](https://formulae.brew.sh/formula/). Go, for example, has version-specific formulae, but Git does not.

If someone had the time and inclination, they could submit version-specific formulae for Hugo, but those formulae are subject to [these restrictions](https://docs.brew.sh/Versions). Most notably:

> Versioned formulae should differ in major/minor (not patch) versions from the current stable release

That means that we could have formulae for v0.101.0 and v0.102.0, but not for v0.102.1, v0.102.2, or v0.102.3.

> [@pitifi9191](#):
>
> The hugo version downgrade isnt that easy

I agree.

The current version of Homebrew is v3.6.0. The `switch` command [was removed](https://github.com/Homebrew/brew/pull/9209) in v2.6.0. Prior to v2.6.0, provided you had not run `brew cleanup`, you could _easily_ revert to an earlier installation with something like:

```bash
brew switch hugo 0.102.1

```

But you can’t do that anymore.

I spent far too much time researching methods to install a specific version via Homebrew when the package does not have version-specific formulae. [This](https://ailinykh.com/homebrew-formula-downgrade/#install-using-local-tap-and-brew-extract) looked promising, but threw an error.

This is the best method that I can find so far:

1. Uninstall the current version with `brew uninstall hugo`

2. Visit [https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/h/hugo.rb](https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/h/hugo.rb)

3. Click the “History” link

4. Find the “bottle” commit for the desired version (example: hugo: `update 0.99.1 bottle`)

5. Press the “Download raw file” button

6. Save `hugo.rb` to any directory (home, downloads, etc.)

7. Open a terminal

8. CD into the directory where you saved the `hugo.rb` file

9. Install with `HOMEBREW_DEVELOPER=true brew install hugo.rb`

10. Prevent automatic updates with `brew pin hugo`

Compare that with building from source:

```auto
# Install the latest version
go install -tags extended github.com/gohugoio/hugo@latest
# Downgrade to something else
go install -tags extended github.com/gohugoio/hugo@v0.100.1

```

The first time you build from source, it will take a minute or two as Go primes the module cache. Subsequent builds will generally be much faster.

* * *

EDIT 2026-01-07T11:41:11-08:00: Updated the procedure above.

---

<div class="post-metadata">

**Author:** ![pitifi9191](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@pitifi9191](https://discourse.gohugo.io/u/pitifi9191)\
**Post date:** [September 13, 2022, 8:43am UTC](https://discourse.gohugo.io/t/how-to-downgrade-hugo-to-a-previous-version/40388/6 "2022-09-13T08:43:32Z")

</div>

Hi @jmooring

Thanks again for such a detailed response and for providing the solution. I was able to install the previous version using `brew install hugo.rb`.

If hugo creates a page or link where one can support the development of hugo to be added to homebrew list of version specific so i can install using `brew install hugo@0.102.0` please update this post.

Thank you again for great support.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [September 13, 2022, 5:42pm UTC](https://discourse.gohugo.io/t/how-to-downgrade-hugo-to-a-previous-version/40388/7 "2022-09-13T17:42:11Z")

</div>

Another [restriction](https://docs.brew.sh/Versions) for versioned Homebrew formulae:

> No more than five versions of a formula (including the main one) will be supported at any given time.

So, as of today, we could only have these formulae.

- latest (v0.102.3)
- v0.102.0
- v0.101.0
- v0.100.0
- v0.99.0

That means you would not be able to install:

- v0.102.2
- v0.102.1
- v0.100.2
- v0.100.1
- v0.99.1
- v0.98.0
- etc.

Given this restriction, I don’t think it’s worth the effort to create and maintain multiple formulae.

---

<div class="post-metadata">

**Author:** ![gaetawoo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/gaetawoo/32/16789_2.png) [@gaetawoo](https://discourse.gohugo.io/u/gaetawoo)\
**Post date:** [September 13, 2022, 7:05pm UTC](https://discourse.gohugo.io/t/how-to-downgrade-hugo-to-a-previous-version/40388/8 "2022-09-13T19:05:41Z")

</div>

Maybe it’s a matter of people who know vs people who don’t know, but I can’t imagine using any other installation method beyond downloading the zip, unzipping it into the specific folder, adding that folder to the system path, and moving on with life. Then upgrading or downgrading is a simple matter of overwriting the file. (or as extra credit, just appending the version number to the executable so when you run it you run the version you desire)

---

<div class="post-metadata">

**Author:** ![pitifi9191](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@pitifi9191](https://discourse.gohugo.io/u/pitifi9191)\
**Post date:** [September 14, 2022, 9:52am UTC](https://discourse.gohugo.io/t/how-to-downgrade-hugo-to-a-previous-version/40388/9 "2022-09-14T09:52:36Z")

</div>

Hi @gaetawoo

1. Seems like you are not using mac as installing directly doest work on mac even if you whitelist hugo as developer.
2. using a package manager is the easiest option to manage multiple tools like hugo for example golang
3. your method doesnt seems easy even as you explain comparing to a single command `brew install hugo`

But that is a preference, not people who know vs who dont know. Even the senior developers i have are using package manager not because they dont know how to install directly.

Thanks

---

<div class="post-metadata">

**Author:** ![pitifi9191](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@pitifi9191](https://discourse.gohugo.io/u/pitifi9191)\
**Post date:** [September 14, 2022, 9:55am UTC](https://discourse.gohugo.io/t/how-to-downgrade-hugo-to-a-previous-version/40388/10 "2022-09-14T09:55:28Z")

</div>

Hi @jmooring

Thanks i didnt knew this restriction.

---

<div class="post-metadata">

**Author:** ![gaetawoo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/gaetawoo/32/16789_2.png) [@gaetawoo](https://discourse.gohugo.io/u/gaetawoo)\
**Post date:** [September 14, 2022, 4:38pm UTC](https://discourse.gohugo.io/t/how-to-downgrade-hugo-to-a-previous-version/40388/11 "2022-09-14T16:38:21Z")

</div>

Your point is well taken. I had not even considered that Mac operating system wouldn’t allow that. And yes, it would be technically easier to have a single click install from a store or repository. But in my view, the beauty that hugo is a single binary it can just be itself, no install or uninstall crumbs in registry.

---

<div class="post-metadata">

**Author:** ![cshoredaniel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cshoredaniel/32/19684_2.png) [@cshoredaniel](https://discourse.gohugo.io/u/cshoredaniel)\
**Post date:** [September 14, 2022, 4:55pm UTC](https://discourse.gohugo.io/t/how-to-downgrade-hugo-to-a-previous-version/40388/12 "2022-09-14T16:55:46Z")

</div>

As was pointed out in

> [@1 thing i dislike about hugo](https://discourse.gohugo.io/t/1-thing-i-dislike-about-hugo/40387/8):
>
> Re #1, you always have to open the Mac’s Security and Privacy settings and give the hugo binary permission to run. The following instructions assume you have a folder (which we’ll call bin) in your system PATH. (Note: Regarding the system PATH, you may want to consult [this article](https://zwbetz.com/how-to-add-a-binary-to-your-path-on-macos-linux-windows/).) Go to [Hugo’s releases page](https://github.com/gohugoio/hugo/releases) and download the file with Hugo software for your Mac. For v.0.102.x and up, it’s a universal binary that will install on either Intel or Apple Silicon CPUs. (I highly recommend you alway…

It is possible to install directly on the Mac, but yes, the Mac makes it annoyingly difficult to install Hugo directly.

For most users it’s trivial to install Hugo directly.

Apple, from my understanding, is not exactly welcoming to open source projects like Hugo and Go, and many others, and third party tools are required for a decent experience when using open source.

I don’t think that is going to change any time soon, and since the issue is really with imposed limitations by Apple and/or Homebrew, they are the ones you need to raise an issue with for a change that doesn’t put ridiculous amounts of work on individual developers or projects. YMMV.

---

<div class="post-metadata">

**Author:** ![Fuad\_Efendi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/fuad_efendi/32/17882_2.png) [@Fuad\_Efendi](https://discourse.gohugo.io/u/Fuad_Efendi)\
**Post date:** [June 8, 2024, 11:50pm UTC](https://discourse.gohugo.io/t/how-to-downgrade-hugo-to-a-previous-version/40388/13 "2024-06-08T23:50:16Z")

</div>

I am not sure why to “install” it if it is single command line tool (single file!) - just download, add to classpath, create aliases - so that you can even have multiple versions available
