Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

SteveJobzniak

macrumors 6502
Original poster
Dec 24, 2015
489
780
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?
 
Last edited:

NoBoMac

Moderator
Staff member
Jul 1, 2014
5,774
4,363
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).

Container mount state: mounted
bundle id: 16032
Mach-O UUIDs: 073BA5FE-F5D6-326E-9A32-64F3D480BC07
sequenceNum: 753
FamilyID: 0
PurchaserID: 0
DownloaderID: 0
installType: 0
appContainer:
dataContainer:
path: /Applications/TextEdit.app
name: TextEdit
displayName: TextEdit
itemName:
teamID: 0000000000
staticSize: 0
storeFront: 0
versionID: 0
sourceAppID:
category: public.app-category.productivity
identifier: com.apple.TextEdit (0x80059d0e)
canonical id: com.apple.textedit (0x8005301d)
vendor:
type:
version: 325.0 (0x0005140000000000)
versionString: 325
displayVersion 1.11
codeInfoID:
mod date: 3/21/2016 19:09:53
reg date: 3/21/2016 19:26:17
type code: 'APPL'
creator code: 'ttxt'
flags: apple-internal has-display-name relative-icon-path has-entitlements
item flags: container package application extension-hidden native-app scriptable services x86_64
icons: Contents/Resources/Edit.icns
executable: Contents/MacOS/TextEdit
inode: 22124097
exec inode: 28432565
container id: 32
min version: 10.10 (0x0000280001400000)
mach min ver: 10.11 (0x0000280001600000)
execSDK ver: 10.11 (0x0000280001600000)
properties:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

[...]
--------------------------------------------------------
claim id: 21108
name: NSStringPboardType
rank: Default
reqCaps:
roles: Editor
flags: apple-default apple-internal relative-icon-path doc-type
icon: Contents/Resources/txt.icns
bindings: public.text
--------------------------------------------------------
claim id: 21148
name: NSStringPboardType
rank: Default
reqCaps:
roles: Editor
flags: apple-default apple-internal relative-icon-path doc-type
icon: Contents/Resources/txt.icns
bindings: public.plain-text
 

SteveJobzniak

macrumors 6502
Original poster
Dec 24, 2015
489
780
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).

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:
secinitd -- The security policy initialization daemon.
secinitd secinitd is a system daemon that initializes the runtime secu-
rity policies for processes. It is not intended to be invoked directly.

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!
 
Last edited:

NoBoMac

Moderator
Staff member
Jul 1, 2014
5,774
4,363
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?
 

SteveJobzniak

macrumors 6502
Original poster
Dec 24, 2015
489
780
Before that, anything showing up in the console log?

Thanks again for the help. I really appreciate it. There is nothing in the console log when I double-click, unfortunately.

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

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!
 
  • Like
Reactions: m0rf3u5

the bug

macrumors regular
Feb 21, 2014
103
14
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/)

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
 

SteveJobzniak

macrumors 6502
Original poster
Dec 24, 2015
489
780
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. ;)

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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.