I had a need to rebuild an old iMac with macOS Sierra. That in itself was a challenge to try and get a hold of the Install macOS Sierra.app file as Apple no longer host it, but, I did manage to get a hold of the InstallOS.dmg which in turn had a .pkg file gave you the installer.

A short tangent later after then finding a High Sierra VirtualBox image so I could unpack it, I got to the stage of needing to build the USB disk.

Apple’s support doc on this is fine however it took some Google’ing to find the solution to my issue. I tried to run the command as follows…

  $ sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume --applicationpath /Applications/Install\ macOS\ Sierra.app

… but after a few minutes it died with this lovely message:

2021-11-05 14:07:09.635 createinstallmedia[79227:221251] *** Terminating app due to uncaught exception 'NSInternalIncons
istencyException', reason: 'Couldn't posix_spawn: error 35'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff205811db __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x00007fff202bad92 objc_exception_throw + 48
	2   Foundation                          0x00007fff21317a51 -[NSConcreteTask launchWithDictionary:error:] + 4990
	3   Foundation                          0x00007fff2133dc29 +[NSTask launchedTaskWithLaunchPath:arguments:] + 146
	4   createinstallmedia                  0x0000000104ed3968 createinstallmedia + 6504
	5   libdyld.dylib                       0x00007fff2042af3d start + 1
	6   ???                                 0x0000000000000005 0x0 + 5
)
libc++abi: terminating with uncaught exception of type NSException
/Volumes/MyVolume is not a valid volume mount point.

Again, back to Google and I came across this article which fixed the problem!

The magic line of code:

  $ sudo plutil -replace CFBundleShortVersionString -string "12.6.03" /Applications/Install\ macOS\ Sierra.app/Contents/Info.plist

With that run, you can then go back to creating the installer as normal:

  $ sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume --applicationpath /Applications/Install\ macOS\ Sierra.app
Ready to start.
To continue we need to erase the disk at /Volumes/MyVolume.
If you wish to continue type (Y) then press return: y
Erasing Disk: 0%... 10%... 20%... 30%...100%...
Copying installer files to disk...

Copy complete.
Making disk bootable...
Copying boot files...
Copy complete.
Done.