macOS filesharing incomplete file copy after app build

Sometimes I use remote debugger, but sometimes I need to copy the actual app to another machine for testing. If I try to move this app to another mac (via a shared folder, e.g. System Preferences / Sharing / File Sharing / Shared Folders) I find that the destination mac often fails to copy the app completely: after copying, the app icon is often greyed out, or has the X through the icon. The app often has the wrong size (too small by 25% to 50%). When I look inside the app bundle, often the executable (e.g. myApp.app/Contents/MacOS/myApp ) is missing.

In other words:

  • build app on mac A
  • on mac A, copy the built app to the shared folder (hosted by mac A)
  • on mac B, in the Finder, show the app
  • try to launch the app (or try to copy the app to the desktop and then launch)
  • results: various failures “This app is damaged” etc.

Sometimes, duplicating or renaming the app (either on mac A or B) will fix things, sometimes not.

I think the problem is timing dependent, as it seems to happen more often when I’m moving quickly during debugging. If I take the steps more slowly, it seems to work more often (but is never 100% successful).
This seems like a bug in macOS Finder or SMB file sharing, not a Xojo bug.

My question: is there any thing I can do to work around it? Is there a command to tell Mac A “This file is built, please do whatever magic is necessary to realize it’s whole?” Ideas: Spotlight? Quarantine?

Have you tried compressing the file to a zip archive before copying it?

remember this… a Mac “app” is a “bundle” and a “bundle” is just a “special folder structure”
are you sure that the copy had TIME to complete… it will depend on the size of the bundle, the speed of the shared connection on your LAN (ethernet vs wifi etc)

I have done this same operation, many times between my desktop and a laptop… and never had this issue…
however… it has been with Xojo2016R1 and earlier… so if this is r2017 that may be part of the issue.

I doubt seriously that it is a macOS issue… as Xojo apps are not the only “bundles” that are moved between Macs on a regular basis

[quote=350529:@Dave S]remember this… a Mac “app” is a “bundle” and a “bundle” is just a “special folder structure”
are you sure that the copy had TIME to complete… it will depend on the size of the bundle, the speed of the shared connection on your LAN (ethernet vs wifi etc)[/quote]

  1. Yes. It’s over gigabit ethernet, so the copy takes about a second.
  2. The behavior is the same even if I never copy the app - instead if I just launch it from the shared folder.

The clues that are most interesting to me is that Mac B, in the finder, while showing the App bundle in Mac A’s shared folder, will not show it consistently:

  • Sometimes the icon has a X through it - I believe this is a gatekeeper function, in which the Finder won’t load an app’s icon before the first time you run the app. Presumably this is a security feature to prevent malware in the icon file. Once you’ve run the app and gatekeeper thinks it’s “safe”, then the icon starts showing up in the finder.
  • Sometimes the icon is greyed out without the X through it. I’m not sure what this means, but I think it means “although this is an .app bundle, the finder is not seeing the executable so you can’t actually run this app”

I forgot to mention that in my current tests, Mac A is running 10.12.6 and Mac B is running 10.13.0 - but… I’ve also seen this behavior with both macs on 10.12.x.