“Every day, the first time I run Hugo it’s very, very slow…”
hugo v0.109.0+extended darwin/amd64 BuildDate=unknown
| EN
-------------------+------
Pages | 125
Paginator pages | 3
Non-page files | 39
Static files | 9
Processed images | 0
Aliases | 4
Sitemaps | 1
Cleaned | 0
Total in 275552 ms
…and if I immediately run Hugo again, it’s blisteringly quick:
hugo v0.109.0+extended darwin/amd64 BuildDate=unknown
| EN
-------------------+------
Pages | 125
Paginator pages | 3
Non-page files | 39
Static files | 9
Processed images | 0
Aliases | 4
Sitemaps | 1
Cleaned | 0
Total in 347 ms
In case you’re seeing this… here might be the reason: you’re using Google Drive or Dropbox to store your Hugo files on your Mac. Not a bad plan in the past.
The new versions of Google Drive and Dropbox don’t keep your files on your computer for very long, and instead “stream” them from the cloud. Normally, that’s fine, but in Hugo’s case, it’s looking at every single file in your site’s folder, which could be hundreds: and it needs to download all of those before it can make your site. Hence the big wait the first time (nearly five minutes), and the fast speed the second.
The solution: go to your Hugo website files folder in Finder, and hit the “download from the cloud” icon. That will ensure that a copy is always cached on your computer; and mean that Hugo doesn’t need to wait for every file to be downloaded all over again.