Bug - Not A Bug Macintosh Sierra - Cannot launch Mafia 17.6 after downloading it

seekerBB

New member
You receive a '“KoLmafia-17.6.app” is damaged and can’t be opened. You should eject the disk image.' message. Going to System Preferences/Security & Privacy gives you only the choice to launch apps downloaded from the app store, or from the App store and identified developers. There used to be a 3rd choice - "Open Anyway," that would appear after you tried to launch Mafia and failed. This was a one-time click; once you did so the app would run fine from that point on.

So the question is, how does one successfully launch a newly-downloaded version of Mafia on Mac OSX 10.12 (Sierra)? Tx.
 

Darzil

Developer
I know nothing about Mac. However, what size is the file, worth checking it was successfully downloaded. (mine not on Mac is 12,755 KB, so I'd expect something around that size)

If not successfully downloaded, clear your browser cache of that file and try again.
 

Theraze

Active member
Use the Jar version instead. I'll try to find at least one of the threads where it's been discussed and the uselessness of the mac-built edition was noted. Initially this was an issue with DMG, but it looks like Gatekeeper probably blocks APP in the same way now, which would make this not a (fixable) mafia bug.

Edit: Here's 5 threads talking about Gatekeeper issues with mafia.
http://kolmafia.us/showthread.php?1...(El-Capitan)-won-t-mount-reports-as-corrupted
http://kolmafia.us/showthread.php?16778-Verions-16-4-for-Mac-download-seems-corrupt
http://kolmafia.us/showthread.php?1...t-s-quot-damaged-quot-when-attempting-to-open
http://kolmafia.us/showthread.php?14537-Cant-run-MAC-version-after-install
http://kolmafia.us/showthread.php?11256-KoLmafia-15-7-dmg-broken-on-Mountain-Lion-due-to-gatekeeper
 
Last edited:

Veracity

Developer
Staff member
You apparently can't launch app that is not from an "identified developer" on newer versions of OS X. I have no idea if it possible for you to get around that and I have no idea what it would take for me, for example, to become an "identified developer". I bet it costs money.

We provide a .app version of KoLmafia for people running older (how old?) versions of OS X, but the fact that those don't work on newer versions is either Not a Bug or Won't Fix.

Your solution is, as Theraze pointed out, is to simply use the .jar file rather than the .app file.

Perhaps I will n longer bother to upload a .app version and will mark the .jar file as the one that OS X users are offered.
 

lostcalpolydude

Developer
Staff member
If the .app version is being dropped, then I can probably upload new point releases too. It has been a while though, and I have some code changes that shouldn't be included.
 

Theraze

Active member
So if this is an Apple decision, and the user can get around it without us making any changes, I think you've conclusively shown that this is Not a Bug (but an Apple security feature) and this thread can be closed as such?
 

seekerBB

New member
Tx all. The dmg I downloaded is 13.2 MB, so I believe I got it all. The steps in the doc Bale pointed to do not work. Steps 1&2 work, but then I receive the "file is damaged" dialog with only a "Cancel" choice. I'm running OSX 10.12.13.

Downloading the .jar and running it by itself works fine. I can also replace the .jar in my current mafia app (17.3) with the new .jar and that runs fine.

Again, many thanks.
 

Veracity

Developer
Staff member
If the .app version is being dropped, then I can probably upload new point releases too. It has been a while though, and I have some code changes that shouldn't be included.
I am pretty sure you can make a .app using the "ant jarbundler". You are stuck on making a .dmg because that uses hdutil, or something, which is a Mac utility.

If you can make a .app, perhaps we should distribute that rather than the .dmg; the only thing the latter does is give you two icons - the .app and a symbolic link to /Applications - so that you can drag the first to the second to install it in /Applications. That's a convenience, but the app works just fine from wherever you install it.

I dure wouldn't mind not being to only one who can spin a point release.
 

Veracity

Developer
Staff member
Tx all. The dmg I downloaded is 13.2 MB, so I believe I got it all. The steps in the doc Bale pointed to do not work. Steps 1&2 work, but then I receive the "file is damaged" dialog with only a "Cancel" choice. I'm running OSX 10.12.13.

Downloading the .jar and running it by itself works fine. I can also replace the .jar in my current mafia app (17.3) with the new .jar and that runs fine.

Again, many thanks.
I can't imagine why the file would be "corrupt". I can run the .app I create just fine. No Gatekeeper, of course, since I created the file on this machine, but the file is not "corrupt". I'm running El Capitan, by the way.

I was wondering if the version of JavaApplicationStub might cause problems, but looking inside the .app bundles for 17.2 and 17.6, the only difference is the .jar file (and a few values in the plist.)

The JavaApplicationStub is twice the size of the one in my Java development environment. I expect that is because it is a universal binary, and all modern ones are Intel-only. But, as I said, the .app starts up just fine with the old stub.

I'll try uploading a .app into a test area and downloading it and running it to see how it goes, but "file is corrupt" makes no sense whatsoever.
 

Bale

Minion
Tx all. The dmg I downloaded is 13.2 MB, so I believe I got it all. The steps in the doc Bale pointed to do not work. Steps 1&2 work, but then I receive the "file is damaged" dialog with only a "Cancel" choice. I'm running OSX 10.12.13.

Nobody here has Sierra OS (I've never even used a Mac) so nobody can talk you through this. You might have to do your own googling on this, but I did a little more research for you. According to people on the internet, your problem should be that something called "Gatekeeper" is trying to protect you from an unidentified developer. It needs to be educated.

This person had the same problem and here's his solution.

That is the same as the "long method" on this site.
 
Last edited:

Veracity

Developer
Staff member
I did "ant jarbundler". It created dist/KoLmafia-17.6.app (which is a folder)
I went to sourceforge and created a directory "Test"
I selected KoLmafia-17.6.app for upload. It created KoLmafia-17.6.app.zip
I downloaded KoLmafia-17.6.app.zip and unzipped it into KoLmafia-17.6.app
I clicked on the KoLmafia-17.6 app.

El Capitan popped up a window saying "Verifying KoLmafia-17.6"
It then said

"KoLmafia-17.6" is damaged and can't be opened. You should move it to the Trash.
[Safari downloaded this file today at 1:13 PM from sourceforge.net]

I control-clicked on the app
I clicked Open in the pop-up
I got the same error

That certainly didn't work the way Bale's linked page said it would work. That document did say:

Note: You can also grant an exception for a blocked app by clicking the “Open Anyway” button in the General pane of Security & Privacy preferences. This button is available for about an hour after you try to open the app.

To open this pane, choose Apple menu > System Preferences, click Security & Privacy, then click General.
Now, I am running El Capitan, not Sierra.

I went to Apple menu > System Preferences, click Security & Privacy, then click General.
I see a set of radio buttons:

Allow apps downloaded from:

o Mac App Store
o Mac App Store and identified developers
o Anywhere

I switched to the last button.

It popped up a window that said:

Choosing "Anywhere" makes your Mac less secure.

This selection will be reset automatically if unused for 30 days. Instead, you can allow an individual application from an unknown developer by control-clicking its icon and choosing "Open".

Yeah, right. not.

I clicked "Allow from Anywhere".

I clicked on the KoLmafia-17.6 app.
It popped up a window saying "KoLmafia-17.6 is an application downloaded from the Internet. Are you sure you want to open it?"
I clicked yes.
It opened successfully.

I went back to Security & Privacy and reset to "Mac App Store and identified developers".

I clicked on the KoLmafia-17.6 app.
It opened up with no problem.

Conclusions:

1) control-clicking the app icon and saying "Open" does not successfully bypass the security. Apple's dialog claims it works, but it did not work.
2) On El Capitan, changing security to allow anything allows opening the app - and having done so, it persists even after restoring the security.
3) I have no idea if this app is now allowed permanently or temporarily.

And lastly,

4) Bale's link suggests that Sierra's security page provides a (temporary) button to allow opening a rejected ash.
 

Veracity

Developer
Staff member
Bale's second link on his newer response says that Sierra will "add the unknown developer to the list of allowed developers".
That's worrisome. As far as I know, we are not specifying the "developer" anywhere.

I just downloaded the 17.6 .dmg from sourceforge
I opened it and moved KoLmafia-17.6 to Applications
I clicked on its icon and got the expected "File is damaged and cannot be opened".
I clicked on the previously "allowed" application I'd built and downloaded - and it opened.

That seems OK.
 

lostcalpolydude

Developer
Staff member
Maybe it's the lack of a specified developer that prevents allowing the individual .app to work, and because of that the only option is to set it to Anywhere.
 

Rudy McTudy

New member
Is there a workaround for this? I'm having the same issue and would really love to use kolmafia.

EDIT: Never mind, I've got a fix for Sierra.

Open Terminal and type in:

sudo spctl --master-disable

then press enter.
Stick in your password and press enter again.
Open up your system preferences.
Go to to security and privacy and you should now be able to select the open apps from anywhere option.

It will now open.

WAHOO!
 
Last edited:

Theraze

Active member
Is there a workaround for this? I'm having the same issue and would really love to use kolmafia.

Yes. Use the Jar rather than the App, as per above. Good that you found a workaround that works for you. Most people won't choose to gut their OS security. :)
 

slifty

New member
I think this is still an issue, and it does have to do with MacOS security (which a user should not have to bypass; in recent MacOS versions the user actually may not even have the ability to).

Some additional information that MacOS provides alongside the "damaged and can't be opened" error:

The app has been modified, and its code does not match the original signed code. The app may be broken or corrupted, or it may have been tampered with. If you think that an app has been damaged or tampered with, you should delete it by dragging it to the Trash.

Some apps and tools, such as AppleScript or JavaScript applications and some legacy tools, modify themselves after signing. These types of apps cannot be opened unless you override the security settings on your Mac. See Open an app by overriding security settings.

To learn how to protect your Mac from harmful software, see Protect your Mac from malware.

It sounds like maybe there aren't many core devs using MacOS; I'd be happy to take on trying to identify the issue and a fix if that's the case / if that would be acceptable.

(If it's a matter of needing a dev license I can probably help provide one)

Update: I believe this `jpackage` bug is the root of the issue: https://bugs.openjdk.org/browse/JDK-8276150

It looks like it's been fixed in jdk 18, though another solution might be to sign the dmg with an apple developer account.
 
Last edited:

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
We need to sign the dmgs yes. I have a signing key I just haven't had the time to sort this out yet
 
Top