2

I use some apps that can accept files a few ways:

  1. open and then use its own file select dialog
  2. "open with" from Finder
  3. "drag & drop" from Finder

Method 1 is fine and the app responds as expected.

Methods 2 & 3 result in the app opening—you can see the app's menu bar and dock icon—but then there is a delay of 4 or 5 seconds before the app window appears.

Apple say:

Engineering has determined that your bug report (39378510) is a duplicate of 19293778 and will be closed.

But why the delay? What is macOS doing? How can I remove the delay?

I've tried:

  • reset launch services (no difference)
  • new/guest user account (no delay!)

Most interestingly:

  1. Build new app with unique ID (no delay on first launch; delay on second launch)
  2. Delete Saved Application State for the app (no delay!) but this regenerates with every run of the app
  3. Deleting only the file data.data (download that file) in the Saved Application State (no delay!)

Workaround: I can prevent Saved Application State on a per-app basis. See here: https://github.com/sveinbjornt/Platypus/issues/110#issuecomment-377398429

Any ideas appreciated.

  • mac OS 10.13.6
  • no antivirus

Here are two videos:

  • I am curious, why are you assuming this a macOS issue and not an issue with the App and how it hooks the system APIs? Have you contacted the App developer? Have you attempted the same actions with different Apps to see if the delay is also present? – Allan Mar 21 '18 at 19:08
  • I've contacted the developer and we discovered that the app behaves perfectly in a guest user account. But in my account there's the 4/5 second delay between the menu appearing and the window appearing. I'm trying to find another app that has a delay like this. @Allan – Matt Sephton Mar 21 '18 at 19:16
  • 1
    That would be a key piece of information to be included in the original question. Given that it doesn't happen in a different account, it's not related to macOS, but rather something specific to your profile. What do you have running in your profile that the other account doesn't have? You can confirm this by booting into Safe mode and seeing if the issue still presents. – Allan Mar 21 '18 at 19:22
  • @Allan it is already included in the original question. I'll try safe mode. – Matt Sephton Mar 21 '18 at 19:45
  • Delay is still there in safe mode. Very odd. Interestingly if I kill -3 -1 and quickly try as all the processes respawn then the delay is gone, at least until all the processes are resumed at which point the delay returns. More info: github.com/sveinbjornt/Platypus/issues/110 – Matt Sephton Mar 23 '18 at 17:06
1

So it seems that the app is for an as yet unknown reason tied-up opening its com.organisation.AppName.savedState from ~/Library/Saved Application State/. I found this out by using FSMonitor whilst launching the app and confirmed it using AppCleaner.

Looking inside the .savedState file I can see that there's a file restorecount.plist, present for exactly as long as the delay, which contains an incremented number which on my install of macOS is about 544,000,000 right now. Half a billion windows restored since Mac OS X 10.7 Lion! The ID seems to be system level, as even the Guest user has roughly the same number in its savedState files.

I'm still interested to know why a new account has faster generation of the restorecount.plist file whilst "old" accounts can be a lot slower.

total window restores

The workaround is to either:

  1. per-user: enable System Preferences > General > Close windows when quiting an app
  2. per-app: in Terminal defaults write com.organisation.AppName NSQuitAlwaysKeepsWindows -bool false which stores it in the app's preference file at ~/Library/Preferences/.

Further discussion at this GitHub issue.

0

The app is probably opening. The video isn't clear if the app is already open.

This is common to all apps. Using excel's dialogue to open a file is instantaneous, while quitting and opening a file takes a couple of seconds.

As to using a guest/new user, the less processes and RAM that is being used will increase how fast the app opens.

  • You can see the menu bar as soon as the App is open. Then the wait of 4/5 seconds until the window appears. In a guest user account there is no such delay and the window appears at the same time as the menu bar. – Matt Sephton Mar 21 '18 at 19:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .