electron-userland/electron-builder

Building on macOS 10.15 fails. Can't locate Mac/Memory.pm

alchaplinsky opened this issue ยท 16 comments

Which version of electron-builder are you using?

  • 20.44.4:

What target are you building for?

  • Mac(dmg):

I'm on MacOs 10.15 (beta2). While trying to build dmg I get following exception:

Error: Exit code: 2. Command failed: /usr/bin/perl /private/var/folders/9c/tprqfcrs66qff3x86tdp3_xw0000gn/T/t-yGVUjs/1-dmgProperties.pl
Can't locate Mac/Memory.pm in @INC (you may need to install the Mac::Memory module) (@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.4/darwin-thread-multi-2level /Library/Perl/Updates/5.18.4 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /private/var/folders/9c/tprqfcrs66qff3x86tdp3_xw0000gn/T/t-yGVUjs/1-dmgProperties.pl line 4.
BEGIN failed--compilation aborted at /private/var/folders/9c/tprqfcrs66qff3x86tdp3_xw0000gn/T/t-yGVUjs/1-dmgProperties.pl line 4.

Can't locate Mac/Memory.pm in @INC (you may need to install the Mac::Memory module) (@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.4/darwin-thread-multi-2level /Library/Perl/Updates/5.18.4 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /private/var/folders/9c/tprqfcrs66qff3x86tdp3_xw0000gn/T/t-yGVUjs/1-dmgProperties.pl line 4.
BEGIN failed--compilation aborted at /private/var/folders/9c/tprqfcrs66qff3x86tdp3_xw0000gn/T/t-yGVUjs/1-dmgProperties.pl line 4.

Possible issue with Perl on new Mac OS?

I am on macOS beta 2 as well having the same issue here... using electron-builder@20.44.4 / electron@4.2.5

same issue

same here

Guys, today I am going to setup my Raspberry PI and make snap for ARM working. Then, later this week, I will take a look on this issue. Sorry for delay, if it is important for you, you can send PR or donation.

Same issue; pretty sure it's related to Catalina not shipping with Perl installed.

I tried installing it myself, but Mac::Carbon and Mac::Memory don't install on 64bit Perl. Went as far as trying to rebuild Perl for 32bit, but looks liked xCode deprecated building for 32bit altogether.

Not only xcode but look like the entire operating system doesn't allow 32bit programs. Running wine to build for win32 or just using wine by itself doesn't work:

file /usr/local/bin/wine
/usr/local/bin/wine: Mach-O executable i386

wine -v
zsh: bad CPU type in executable: wine

@dotconnor Yup, you're right macOS Catalina does not Support 32-bit Apps.

Also, for anyone that stumbles into this; this is only a problem when trying to package you app into a dmg. It works fine if you make a pkg instead (more recommended to distribute apps as packages anyways).

*May be different if you're distributing into the mac app store.

Yes, it is only for DMG, because no official tool and open API to perform customization of DMG. electron-builder uses 3rd-party solution, that written in Perl. Should be ported to Go language (from this perl code or from python).

@UdaraJay Thanks a lot.
And to whom don't know how to build pkg instead of dmg, you could edit the package.json:

"build":{
      "mac": {
          "icon": "build/icons/icon.icns",
          "target":"pkg"
       }
}

All existing solutions, including appdmg, are bad and cannot help to create correctly positioned DMG Windows. Problem โ€” window position is computed from bottom, and not from top. So, as you don't know user display screen height, you cannot correctly set window bounds.

If you will set only size, then Finder will ignore size, and your background image will look ugly.
Apple keep silent and don't provide not only tool to customize DMG, but even docs about DSStore format.

Irony that used by electron-builder solution in Perl is able to set windows position from top because uses deprecated format. And now Apple killed mac carbon 32-bit completely. Enjoy :(

As I don't have time to convert Perl solution in Go (as Go is the only language that should be used for such tools, forget about nodejs or python), for now following solution is implemented:

  • if you don't set window position at all, then:
    • if background color is used โ€” window bounds is not set and Finder will position your windows in center of the screen with some OS specific size.
    • if background image is set โ€” then x is set to 400 (as before), and y is set to (1440 - backgroundHeight) / 2 where backgroundHeight it is computed automatically height of specified background image. Yes, assumed that 1440 it is height of user display (lesser of two evils).
  • if you set window bounds:
    • if you set only size โ€” x/y is set as for "background image is set" step.
    • if you set both x/y and width/height โ€” it is used as is.

I do not have time and plans to implement decent solution (as it was in Perl). First, because Perl solution format is deprecated for ages already, and maybe Apple will drop it sometime. Second, burn in hell, Apple (yes, it seems Apple don't care about developers who don't distribute apps via AppStore).

DropDMG app creates correctly positioned DMG windows. Maybe I will ask ability to reuse DropDMG CLI / support it.

Release will be in 2 days.

@develar ,
Could you please let me know what changes are required to fix this issue on Catalina?

update electron-builder version to 21.2.0

sudo npm i electron-builder@latest -S worked for me

But higher version electron-builder needs higher node version.

macos@10.15 needs electron-builder@21.2.0
electron-builder@21.2.0 needs node>=8.12

So I can not fix it with node@8.9

In the end, I changed it to zip type and it succeeded without affecting the automatic update.

"build":{
"mac": {
"icon": "build/icons/icon.icns",
"target":"zip"
}
}