Skip to content

Instantly share code, notes, and snippets.

@kcassam
Last active February 15, 2019 08:39
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kcassam/6707152 to your computer and use it in GitHub Desktop.
Save kcassam/6707152 to your computer and use it in GitHub Desktop.
Make spotlight index any file

Make spotlight index any file

Problem :

Spotlight was not searching into certain files, even if simple text files (in my case .INI files)

Solution

Easy solution

  • Download TextWrangler.app from the App Store.
  • Reindex (?) mdimport -r /System/Library/Spotlight/RichText.mdimporter

End of story.

Painful solution

  • In terminal, type

mdimport -n -d1 file.extention

You should see one of the above, dependig if the type file is known by the OS or not

  • unknown UTI : Imported 'file.extention' of type 'dyn.ah62d4rv4ge80e2pcr74u'

  • known UTI : Imported 'file.extention' of type 'com.domain.other'

    • Add this type in /System/Library/Spotlight/RichText.mdimporter/Contents/Info.plist (or other mdimporter if appropriate)
    • Reindex mdimport -r /System/Library/Spotlight/RichText.mdimporter

Litterature

@9840380
Copy link

9840380 commented Feb 15, 2019

not working
1.Add to MyUTIs.bundle

<key>UTExportedTypeDeclarations</key>
	<array>
		<dict>
			<key>UTTypeConformsTo</key>
			<string>public.plain-text</string>
			<key>UTTypeIdentifier</key>
			<string>file.extention</string>
			<key>UTTypeTagSpecification</key>
			<dict>
				<key>public.filename-extension</key>
				<array>
					<string>reg</string>
					<string>ion</string>
					<string>bat</string>
					<string>cmd</string>
					<string>ksh</string>
					<string>kshell</string>
  1. copy to my application folder
  2. add to /System/Library/Spotlight/RichText.mdimporter
<key>LSItemContentTypes</key>
			<array>
<string>file.extention</string>
  1. reindex and restart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment