Resolved Bug? Double-clicking TextEdit documents in Finder only opens them if TextEdit already runs.

Discussion in 'OS X El Capitan (10.11)' started by SteveJobzniak, May 2, 2016.

  1. SteveJobzniak, May 2, 2016
    Last edited: May 2, 2016

    SteveJobzniak macrumors 6502

    SteveJobzniak

    Joined:
    Dec 24, 2015
    #1
    EDIT: THE LAUNCH SERVICES CACHE IN OS X WAS CORRUPT. POST 6 HAS THE SOLUTION IF ANYONE ELSE ENCOUNTERS THIS ISSUE!

    Original post:

    Ever since installing El Capitan (as an upgrade from Yosemite), I've had this issue. My system was pretty much completely clean apart from Logic Pro X and Dropbox, so I don't think it's a 3rd party utility.

    Symptoms: If I double-click a TextEdit document, nothing happens. TextEdit is not launched, and the document is not opened.

    If I "Get Info" on the file, it says it is associated with TextEdit. I tried to set it to another application, chose "Change All", and then set it back to TextEdit and chose "Change All". This temporarily fixed it. For a couple of hours, I was able to double-click TextEdit documents to open them in TextEdit, but then it stopped working again.

    Can't seem to find anyone else with this issue? Any ideas?
     
  2. NoBoMac macrumors 6502a

    Joined:
    Jul 1, 2014
    #2
    Works for me, so, working on assumption your really do have something else changing things (eg. some other text editor, or word processing program, that is always changing default apps at launch).

    A bit of a pain, and will need some shell/Terminal work, but, can help maybe track down.

    Bring up a Terminal window and execute the following:
    Code:
    /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Versions/Current/Support/lsregister -dump > ~/Dump.txt
    view ~/Dump.txt
    If not wanting to deal with the "vi" editor, can always right-click > Open With... on Dump.txt (will be in the accounts top-most folder).

    You then will want to look for "public.plain-text". In "view", the search command is the "/" character: enter that then the pattern. To search again on same patter, just enter "/" character again. Search backward is "?" character.

    What you want to look for is "public.plain-text" that resides within a "bundle". To see if in a bundle, will need to scroll backwards. In "view", the command is ctrl-b.

    Basically, looking for what tools are defined to open text files. Here's a HIGHLY trimmed down version of the dump showing what you are looking for. This is the definitions on my TextEdit.app and what it can open. If you have, for example, Office installed, it too will have entries for text files. Ditto OpenOffice/LibreOffice, TextWrangler, etc. So, will need to dig deep into the file to see who is claiming the text type: one of those apps might be making wholesale changes to defaults.

    And: as mentioned above, there could be multiple apps that can open the type, want to find the entry that is "Default". But not all "Default"s are for editors (could be for other actions; so yes, a pain, but, will start pointing you in the right direction).

     
  3. SteveJobzniak, May 2, 2016
    Last edited: May 2, 2016

    SteveJobzniak thread starter macrumors 6502

    SteveJobzniak

    Joined:
    Dec 24, 2015
    #3
    The association isn't changing. It's always set to TextEdit, but it's not opening when I double-click text files.

    Thanks a lot for the debug method and detailed instructions, so that I could see what OS X thinks is associated. It helped a lot. I see that com.apple.TextEdit has the role of Editor for plain-text, and is marked Default rank. Nothing else is marked as Editor for that type of file. So it looks correct just like yours. That's good news.

    I just discovered something else that is the true reason for the bug...
    Here's a video of the bug: https://vid.me/5nMa

    In the beginning, TextEdit isn't running. I try double-clicking each file. Nothing happens except the "file being opened" icon fade animation. TextEdit.app does NOT launch.

    Then I manually start TextEdit. Now I can double-click the files and have them open. Until I shut down TextEdit.

    What the heck? Anyone have any ideas? :)

    Edit: I closed TextEdit and ran the command to totally wipe out its internal settings (the folder that houses its cache, preferences etc), but it didn't help: "rm -rf ~/Library/Containers/com.apple.TextEdit/"... The TextEdit application still refuses to open double-clicked text documents in the Finder unless TextEdit is already running. Weirdest bug ever?

    Edit 2: I tried "Get Info" on a .txt file and set it to Console and pressed Change All. Then back to TextEdit and pressed Change All. It still won't launch when I double-click the files. So the last time that trick "worked" I must have been already running TextEdit in the background.

    Edit 3: Closer to an answer...

    1. Closed TextEdit...
    2. Ran "sudo fs_usage | grep TextEdit" to catch any reference to TextEdit by any process.
    3. Double-clicked a .txt file. All I see is this:
    Code:
    21:39:05  lstat64           /Users/xxx/Library/Preferences/com.apple.TextEdit.plist                    0.000013   secinitd
    21:39:05  lstat64           /Users/xxx/Library/Preferences/com.apple.TextEdit.plist                    0.000003   secinitd
    21:39:05  lstat64           m.apple.quicklook.ui.helper/Data/Library/Preferences/com.apple.TextEdit.plist    0.000010   secinitd
    21:39:05  stat64            ../../../../../Preferences/com.apple.TextEdit.plist                              0.000005   secinitd
    21:39:05  readlink          m.apple.quicklook.ui.helper/Data/Library/Preferences/com.apple.TextEdit.plist    0.000004   secinitd
    21:39:05  lstat64           ferences/ByHost/com.apple.TextEdit.AA7E6299-E240-5BEB-B36C-4069A0DBCF9D.plist    0.000013   secinitd
    21:39:05  lstat64           ferences/ByHost/com.apple.TextEdit.AA7E6299-E240-5BEB-B36C-4069A0DBCF9D.plist    0.000004   secinitd
    21:39:05  lstat64           ferences/ByHost/com.apple.TextEdit.AA7E6299-E240-5BEB-B36C-4069A0DBCF9D.plist    0.000008   secinitd
    21:39:05  stat64            ferences/ByHost/com.apple.TextEdit.AA7E6299-E240-5BEB-B36C-4069A0DBCF9D.plist    0.000005   secinitd
    21:39:05  readlink          ferences/ByHost/com.apple.TextEdit.AA7E6299-E240-5BEB-B36C-4069A0DBCF9D.plist    0.000004   secinitd
    
    So really, all that happens upon double-clicking is that "secinitd" tried to read a TextEdit plist (which doesn't exist, as seen by the lack of any reads after stat). Then it manages to find one inside some "m.apple.quicklook.ui.helper/Data/Library/Preferences/com.apple.TextEdit.plist" path. And that is all...

    Info on secinitd:
    Seems "secinitd" is doing some Gatekeeper check and refusing to proceed to launching? My Gatekeeper is set to "Mac App store and identified developers", and TextEdit.app has not been modified by me. Setting Gatekeeper to "Anywhere" doesn't solve anything.

    Edit 4:
    I investigated the .plist file. It's "
    ~/Library/Containers/com.apple.quicklook.ui.helper/Data/Library/Preferences/ByHost/com.apple.TextEdit.AA7E6299-E240-5BEB-B36C-4069A0DBCF9D.plist" and it's a symlink to "~/Library/Preferences/ByHost/com.apple.TextEdit.AA7E6299-E240-5BEB-B36C-4069A0DBCF9D.plist". The target file doesn't exist. So the plist doesn't seem related to the issue.

    Edit 5:
    I checked the security policy for TextEdit.app via "spctl -a /Applications/TextEdit.app" and it said nothing (means it's OK; if an app is bad it would say "rejected").

    I'm out of ideas. Any ideas, anyone? Why won't secinitd launch TextEdit? Double-clicking .txt/.rtf files launches secinitd which does some weird plist check and then doesn't launch TextEdit. But if TextEdit is already running, it opens the document. Annoying and weird!
     
  4. NoBoMac macrumors 6502a

    Joined:
    Jul 1, 2014
    #4
    Weird.

    You might try re-installing the OS. Since the install won't overwrite your data/settings, might fix what might be corrupted at the OS level.

    Before that, anything showing up in the console log?
     
  5. the bug macrumors member

    the bug

    Joined:
    Feb 21, 2014
    #5
    You could try downloading the version of Onyx for your OS.
    http://www.titanium.free.fr/onyx.html
    There is a command in there to rebuild launch services, I'd also try cleaning all the caches too.
    Hopefully this helps.

    - Jay
     
  6. SteveJobzniak thread starter macrumors 6502

    SteveJobzniak

    Joined:
    Dec 24, 2015
    #6
    Thanks again for the help. I really appreciate it. There is nothing in the console log when I double-click, unfortunately.

    IT FIXED IT!!! I didn't want Onyx so I found the command to erase the local "Launch Services" database. It's as follows (it clears and rebuilds the Open With menu and all file associations):

    Code:
    /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
    
    (Source: http://www.tekrevue.com/tip/rebuild-launchservices-fix-duplicate-entries-os-xs-open-menu/)

    After I ran that command, I can now double-click to open text documents even when TextEdit is closed! It was an instant fix! You just saved me from wasting a day of my life reinstalling OS X.

    Turns out the launch services database was corrupt. Now it's working perfectly. This is great! :) Thanks to both of you for helping me solve this!
     
  7. the bug macrumors member

    the bug

    Joined:
    Feb 21, 2014
    #7
    I'd rather be lucky than good ! :)
    Me, I'm lazy.
    I'm typing unix commands all day, when I get home I just want to double click and have it run for me. ;)
    Glad that did it for you.

    - Jay
     
  8. SteveJobzniak thread starter macrumors 6502

    SteveJobzniak

    Joined:
    Dec 24, 2015
    #8
    Haha, thanks Jay. I had never heard of LaunchServices before and wouldn't have figured it out without you. It's the first time I had a "serious" / difficult problem with my Mac, too. And I got it in 2009. Good job, Apple! :p
     

Share This Page