Hugo new ... complains about mkdir failing (0.97.3)

hugo new blog/test/ gives me this with
hugo v0.97.3-078053a43d746a26aa3d48cf1ec7122ae78a9bb4+extended darwin/amd64 BuildDate=2022-04-18T17:22:19Z VendorInfo=gohugoio on macOS 12.4:

panic: mkdir /home/ck: operation not supported

goroutine 1 [running]:{0x63700a0, 0x741e260}, {0x63700a0?, 0x741e260}, {0x6370630, 0xc0000a71d0})
	/root/project/hugo/hugofs/fs.go:108 +0x4db
	/root/project/hugo/commands/commandeer.go:399 +0x88
sync.(*Once).doSlow(0x6370630?, 0x5e37357?)
	/usr/local/go/src/sync/once.go:68 +0xc2
	/root/project/hugo/commands/commandeer.go:397 +0x9b9, 0x1, 0x0, 0xc000712620, {0x635aaa0?, 0xc00058ff80}, 0xc00000eb40, {0x0, 0x0, 0x0})
	/root/project/hugo/commands/commandeer.go:208 +0x310, 0x0?, 0x0?, 0x2c?, {0x635aaa0?, 0xc00058ff80?}, 0x44d92a5?)
	/root/project/hugo/commands/hugo.go:126 +0x31*newCmd).newContent(0xc00058ff80, 0xc000523180, {0xc00042d350, 0x1, 0x0?})
	/root/project/hugo/commands/new.go:74 +0xa5*Command).execute(0xc000523180, {0xc00042d320, 0x1, 0x1})
	/go/pkg/mod/ +0x67c*Command).ExecuteC(0xc000613400)
	/go/pkg/mod/ +0x3b4{0xc0000b60a0, 0x2, 0x2})
	/root/project/hugo/commands/hugo.go:93 +0xb4
	/root/project/hugo/main.go:23 +0x57

The current directory is /Users/ck/develop/websites/unterwegs. So what is /home/ck even doing there (I’m on macOS which has no /home/ directory). Also, I have of course write permission in the current directory and it’s subdirectories.

I have an archetypes/ in my project’s root that looks innocent to me:

title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
featured_image: ""
description: ""
destination: ["Europa"]
country: [""]
city: [""]

I’m sure that hugo new ... worked at some time in the past, though. Searching in the forum lead me to

but that bug was apparently fixed some versions back.

Edit: In my config.toml, I have

publishDir = "/home/ck ..."

but that should not concern hugo new. Or should it?

A change was made in v0.91.2 to address #8166. From this release forward, hugo new creates the publishDir if it doesn’t exist.

Using v0.91.2 with your configuration throws this error:

Error: add site dependencies: create deps: create PathSpec: mkdir /home/ck: permission denied

Using v0.97.0 and later with your configuration causes a panic:

panic: mkdir /home/ck: permission denied


  1. I’m not sure why the publishDir is created when running hugo new, hugo config, or hugo list. It seems like this should only be required when building the site.
  2. Regardless of #1, we should not panic. This is a bug.
1 Like

My thoughts, exactly. Especially since I’m working on a Mac and deploying on a Linux system – very different file system layout.

I think you can handle this with different configs for dev and production.

I could. Or Hugo could simply not create a directory in a context where it’s not needed. Or both.

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