I'm unable to package an Unreal Engine game with productbuild: error: Can't write temporary package to

Well I'm unable to package an Unreal Engine game with productbuild: error: Can't write temporary package to, after doing this:

changing rpath to every executable needed to change install_name_tool -rpath "path/tofile/incorrect" "path/tofile/correct" "path/tofile/correct/file.dylib" and adding the needed with install_name_tool -add_rpath "path/tofile/correct" "path/tofile/correct/file.dylib"

then signing each dylib with find Myapp/Contents | grep .dylib | xargs codesign -f -v -s "Apple Distribution: Team (ID)" --entitlements "entitlements.plist" --options runtime --timestamp

then sign the executable with codesign -f --deep -s "Apple Distribution: Team (ID)" Myapp.app

then try the pkg file to send to store with productbuild --sign "3rd Party Mac Developer Installer: Team (ID)" --component Myapp.app /Applications app.pkg

and finally I couldn't package with error: productbuild: error: Can't write temporary package to

and I really wanted to publish the game in Apple Mac Store.

Is there any fix for this?

Any help will be appreciated. Thank you

Replies

then sign the executable with codesign -f --deep …

Don’t do that. See --deep Considered Harmful for an explanation as to why. And see the following for a bunch of general hints and tips on this subject:

and finally I couldn't package with error: productbuild: error: Can't write temporary package to

Is that the whole error? There’s no info on where it was trying to write the temporary package to?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

So I have a backup with the app already with rpath setup I signed again each dylib then I signed with codesign -f -v -s "Apple Distribution: Rui Oliveira (2LQ42S86QX)" --entitlements "entitlements.plist" --options runtime --timestamp "my app.app" and got this output message myapp.app: signed app bundle with Mach-O thin (x86_64) [com.mycompany.appname]

then I did again productbuild --sign "3rd Party Mac Developer Installer: Team (ID)" --component myapp.app /Applications app.pkg

and output error complete is :

productbuild: error: Can't write temporary package to "/var/folders/f9/509z5hw118v4p5yv2h2s3m3w0000gn/T/TemporaryItems/NSIRD_productbuild_DY4Oll/com.mycompany.myapp.pkg" (Cannot write package to "/var/folders/f9/509z5hw118v4p5yv2h2s3m3w0000gn/T/TemporaryItems/NSIRD_productbuild_DY4Oll/com.mycompany.myapp.pkg".).

Could it be a permission problem in temp folders?

Are you doing this from Terminal? Or in some sort of CI environment? If it’s the latter, try the former.

Also, do this stuff as a normal user, not root. That is:

  • Not from a root shell

  • Not using sudo

I regularly see folks do everything as root and that doesn’t end well on macOS.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Well I was checking security and privacy settings and I gave to terminal full access to disk.

Im using only terminal in a normal shell no sudo or extra powers beside the settings in security and privacy for terminal.

So I'm going to check with that disabled.

Always fails same error.

I disabled the full access to disk did a hard reset to zsh and as I was using an external disk to save the file I moved the file to internal disk and I ended with same error.

Seems even more a permission problem under temp folders.

What disk capacity you recommend for this operation I have 56Gb free in internal the file has 16Gb?

I have 56Gb free in internal the file has 16Gb?

You’re trying to package a 16 GB app?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Yes Quinn is a 16Gb app.

OK. Earlier you wrote:

I have 56 GB free in internal

How did you measure that?

You may be being ‘lied’ to by the Finder. Run the following command:

% df -h .

Does it report a similar value?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Yes it lied I had less space than what I was thinking I free some more space and had 54Gb but still the same error message. Is there any space requirement for productbuild command? I imagine it will need the package space and more I don't know how much to build with command line tools.

Yes it lied I had less space than what I was thinking

Disk free space is a surprisingly complicated question )-:

Is there any space requirement for productbuild command?

I don’t know of any specific documentation for that but I’d expect that 54 GB should be enough for a 16 GB app [1].

Honestly, I’m not sure what’s going on here )-:

The next step is to drop down a level. If you (just for the sake of debugging) drop down to pkgbuild, does it fail similarly?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] My rationale is that productbuild first has to create the package and then sign it. The package shouldn’t be bigger than the original app and so the most I’d expect it to use is 2x. However, that’s just a guess as to the upper bound. I’ve never looking into the mechanics of this.

Quinn i confirm with pkgbuild the file is too large going to free some more space.

After I did pkgbuild --identifier com.mycompany.appname --sign "3rd Party Mac Developer Installer: Team (ID)" --install-location /Applications --component /path/to/myapp.app /path/to/myapppkg.pkg

reproduced a error: pkgbuild: error: Cannot write package to "/path/to/myapp.pkg". (The operation couldn’t be completed. File too large)

I free up to 4x the app size and still same error must be the pak file inside of it of 16Gb the issue there must be a limit I don't know...

Im going to cook the app inside unreal engine without generate the pak file and I think it will fix the problem Thank you Quinn.

So, file too large suggest that this isn’t a disk space issue but a file size issue. Both tools have a --large-payload option that might help with this. My reading of the pkgbuild man page is that this is only relevant if one single file is larger than 8 GiB — which is why I didn’t bring it up earlier — but I might be misinterpreting that.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"