Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS. You can't open the application "..." because it may be damaged or incomplete. #525

Open
relink2013 opened this issue Jul 26, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@relink2013
Copy link

Any app I create shows You can't open the application "app_name" because it may be damaged or incomplete. when trying to launch it.

I was originally using Waterfox but to simplify troubleshooting I switched to Firefox. When I made the switch I removed any trace of Waterfox, Firefox, and the PWA extension, runtime, and connector.

I then Re-Installed Firefox from a fresh download. Installed the PWA Extension, installed the connector from home-brew and installed the default runtime from the PWA extension itself.

Everything appears fine and there are no errors in the extensions console. However the debug log does show numerous errors all seemingly related to the icon...

Im not sure what else to try. I ran through all the troubleshooting steps including the total re-install mentioned above more than once. Especially considering everything works perfectly on my other Mac which is configured exactly the same.

The attached log shows only one attempt to create and launch a ChatGPT PWA in a fresh profile..

firefoxpwa.log

macOS Sonoma 14.5
Intel Core i5
Extension Ver: 2.12.1
Firefox Ver: 128.0.3

@relink2013 relink2013 added the bug Something isn't working label Jul 26, 2024
@filips123
Copy link
Owner

Well, that's weird... Can you check what happens if you try to launch the PWA from terminal using firefoxpwa site launch SITE-ID? Also, can you try to directly run the Contents/MacOS/loader file inside the PWA bundle?

@relink2013
Copy link
Author

Running firefoxpwa site launch 01J3QPF130757MSP12YPC35YQD give the following output, and the app did not open.

The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10827 "kLSNoExecutableErr: The executable is missing" UserInfo={_LSLine=4129, _LSFunction=_LSOpenStuffCallLocal}

Checking the contents of /Users/ME/Applications/ChatGPT.app/Contents/MacOS there is no loader, the folder is completely empty.

@filips123
Copy link
Owner

Do you have Command Line Tools for Xcode installed? You can install them with xcode-select --install.

I'm not sure if this is the problem though, as if you didn't have them, logs should contain a warning message. And the loader should have been created before downloading the icons, so I don't know why it's missing.

Can you check if editing/updating the PWA from the extension fixes the issue? Also, does theproblem happen only with ChatGPT or also with other PWAs?

@filips123 filips123 added the help wanted Extra attention is needed label Aug 1, 2024
@relink2013
Copy link
Author

I tried again with another fresh install of Firefox and noticed this in the stderr.log

12:54:56 [INFO] Web app installed: 01J49JGJXD66GACYFWDK224PHG
12:54:56 [DEBUG] (1) firefoxpwa::integrations::implementation::macos: Verifying that /Users/user/Applications/ChatGPT.app is a web app bundle
12:54:56 [DEBUG] (1) firefoxpwa::integrations::implementation::macos: Verifying if a bundle is a web app
12:54:56 [DEBUG] (1) firefoxpwa::integrations::implementation::macos: 'APPLFFPWA-01J49JGJXD66GACYFWDK224PHG' should be 'APPLFFPWA-01J49JGJXD66GACYFWDK224PHG'
12:54:56 [DEBUG] (1) firefoxpwa::integrations::implementation::macos: Launching web app bundle
The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10827 "kLSNoExecutableErr: The executable is missing" UserInfo={_LSLine=4129, _LSFunction=_LSOpenStuffCallLocal}

@filips123
Copy link
Owner

Unfortunately, I still don't know why this happens.

You can try to manually create and compile a loder file and check if it works:

Create a Swift file:

import Foundation
let task = Process()
task.launchPath = "{firefoxpwa-exe}"
task.arguments = ["site", "launch", "--direct-launch", "{ulid}"] + CommandLine.arguments[1...]
task.launch()
task.waitUntilExit()

You should replace {firefoxpwa-exe} with the path to firefoxpwa binary, and {ulid} with your PWA ULID (for example, 01J49JGJXD66GACYFWDK224PHG).

Compile the file:

swiftc -O -o loader firefoxpwa-loader.swift

Copy the compiled loader binary into Contents/MacOS/.

@relink2013
Copy link
Author

The file I created is:

import Foundation
let task = Process()
task.launchPath = "/usr/local/Cellar/firefoxpwa/2.12.1/bin/firefoxpwa"
task.arguments = ["site", "launch", "--direct-launch", "01J4MCBAQWXMW5KXF58NCJTGV1"] + CommandLine.arguments[1...]
task.launch()
task.waitUntilExit()

But when I tried to compile it I got the following:

swiftc -O -o loader /Users/rlxc/Desktop/ffpwa-rm.swift
/Users/rlxc/Desktop/ffpwa-rm.swift:1:8: error: no such module 'Foundation'
import Foundation
       ^

@filips123
Copy link
Owner

Appearently Foundation module isn't available? But isn't it part of the Swift's standard library?

Can you please try to reinstall Xcode Command Line Tools with xcode-select --install and try again?

@relink2013
Copy link
Author

Ok problem seems to have been solved!

When I ran xcode-select --install I just got a message saying it's already installed. After some searching I found a super simple solution.

remove the current install of the Xcode Command Line Tools with:
sudo rm -rf /Library/Developer/CommandLineTools

Then install a fresh copy using:
xcode-select --install

Loader compiled on the first try, moved it into Contents/MacOS/ and the PWA fired right up!

I have also tried creating new PWAs using the extension directly in Firefox and that now works properly too.

@filips123
Copy link
Owner

I'm not sure why this happened, but it's nice to see that you were able to fix it. Maybe your Xcode CLT installation was somehow corrupted.

I will add better handling to the system integration that checks if the loader has been compiled successfully and displays the error if needed, instead of just failing silently. So, if this happens in the future, it will be at least easier to debug.

@filips123 filips123 moved this to To Do in PWAsForFirefox Aug 9, 2024
@filips123 filips123 added this to the 2.12.2 milestone Aug 9, 2024
@filips123 filips123 modified the milestones: 2.12.2, 2.12.3 Sep 7, 2024
@filips123 filips123 moved this from To Do to In Progress in PWAsForFirefox Sep 15, 2024
@filips123 filips123 modified the milestones: 2.12.4, 2.12.5 Sep 15, 2024
@filips123 filips123 removed the help wanted Extra attention is needed label Sep 26, 2024
@filips123 filips123 removed this from the 2.12.5 milestone Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Progress
Development

No branches or pull requests

2 participants