Exporting app for Mac OS

Exporting the code runs fine and as expected on Windows. However, trying to do the same on Mac is an entirely different story. While the .app file does work like normal when you run it on the device that exported it in the first place, as soon as you send the app, alongside all of the assets it needs to function, to another Mac device, then everything goes wrong. Even uploading and downloading the very same app you exported doesn’t work when trying to run it. The exported app works only if it doesn’t “leave” your device for some reason. Any app downloaded from the internet won’t work even if you were the one to export it in the first place.

By not working I mean the app boots like normal but then freezes and throws a java null pointer error. I think it’s because it can’t access the assets it needs to use at startup and throught the runtime. This by itself is weird as we’ve given the app the permission to access folders and downloads and no other permission is requested for it to function normally.

I have found a workaround however: by right clicking on the app → Show Package Contents → Contents → MacOS → My_Apps_Name and running that file, everything works like normal for some reason I personally don’t know.
Image reference:



I don’t know why running the app this way works and I’d like to find a way to run the sketch like normal, without having to navigate through package contents. Any advice is more than welcome!

Sadly, I can confirm similar findings. I created a very simple test app on my Mac and exported it using File/ExportApplication. The app was placed in a folder entitled “macOS-x86_64” inside my sketch folder. I copy/pasted it to my desktop and had no problem running it. I then made a compressed (.zip) file by right clicking (control-click) on the app and selecting Compress “testApp”. Next I uploaded the compressed file to a DropBox account which is located here: https://www.dropbox.com/s/1264mgy2ntn6v3e/testApp.zip?dl=0. When I downloaded my own file and double clicked on it I see this:
err

I used “xattr” in terminal to see if it was ‘in quarantine’ and apparently it was; I typed “xattr /PathToFile/testApp.app” and it returned “com.apple.quarantine”. I then tried “sudo xattr -r -d com.apple.quarantine /Applications/testApp.app” followed by “open /Applications/testApp.app” and to my surprise it opened. It had failed the first time I tried all of this but worked the second time. I have been a Mac user for many years and I think it is sad that we have to go through all of this because of Apple’s gatekeeper policies. I’m sure that they have a reason for doing it, but the cure may be worse than the disease.

Yeah but why is this happening. Does it have to do anything with permissions? The file is clearly still fine since you can run it through the terminal. Is there anything we can do to combat this? Personally, I know nothing about mac, I even used one of my friends’ laptop to export the file as I don’t have a mac.

Yeah but why is this happening.

It is happening because of the way a corporation (Apple) designed its software. It is a part of their “Gatekeeper” policy, which is designed to discourage malware. Their intentions are good, but as I stated the cure may be worse than the disease. You may read more about it by following the link below or Google it for yourself.

https://superuser.com/questions/28384/what-should-i-do-about-com-apple-quarantine

I’ll give it a read. Thank you very much!