![]() This is really straightforward, but I thought I'd include it for completeness. Remove something from the Spotlight index The output should contain a "type" that looks something like the items in the list above. If you have another file format that is a really just a text file under the hood, you can find out what to add to the ist file by running mdimport -n -d1 somefile.ext in the Terminal. When you are done, you will want to double-click on RichText.mdimporter to re-index all these file formats. public.objective-c-plus-plus-source public.c-plus-plus-source public.objective-c-source public.c-plus-plus-header![]() Inside the Contents folder, double-click on the ist file to open it in TextEdit. Right-click on it and choose "Show Package Contents". Go to Macintosh HD/System/Library/Spotlight and find the RichText.mdimporter file. However, if don't want to install the developer tools (it's a big download) then you can just modify the rich text mdimporter plugin to handle the same job. Make Spotlight index source codeĪpple's developer tools come with a source code mdimporter plugin that allows Spotlight to search the contents of your source code. Many third party applications require plugins to make Spotlight index their file's contents, which are available on the Apple Spotlight plugins page. For example you can search for a word written in a PDF document or the telephone number of one of your contacts. One of the great things about Spotlight is that it will index the contents of many types of files. Add a new file format to the Spotlight index For example, mdimport -r /System/Library/Spotlight/Chat.mdimporter would cause all of your chat files to be re-indexed. Alternatively, you can do this from the Terminal with the command mdimport -r. Double clicking on a plugin will give you the option to re-index all the files associated with it. Each file format has its own plugin, and most are located in Macintosh HD/System/Library/Spotlight or Macintosh HD/Library/Spotlight. When Spotlight adds a file to the index, it checks to see if it recognises the file type and then uses an mdimporter plugin to index the contents if it does. You can re-index other hard drives by changing the command to include their name, like sudo mdutil -E /Volumes/OtherHardDrive. The existing Spotlight index will be deleted, and Spotlight will start creating a new index in the background. In the Terminal, type sudo mdutil -E / and hit return. If you are having problems with your Spotlight index, you might want to start over and re-index your hard drive. To see all the other options, look at the man page by typing man mdfind into Terminal. To run a âliveâ search which will update the results as users add files, use mdfind -live query. To limit this to a specific folder, instead use mdfind -onlyin ~/Desktop query replacing ~/Desktop with the path to your folder. To do a search, just type mdfind query where query is what you want to search for. Search Spotlight from the TerminalĬonsidering Spotlight is so quick and easy to access, you will probably only use this if you are already working in the Terminal and want to find a file, or if you want some extra options. You might want to use this to add the System folder with mdimport -f /System as it isn't searchable by default. However, in Mac OS X 10.4 Tiger and earlier, the command is slightly different if you want the contents of the folder to be indexed too. ![]() Add a folder to the Spotlight indexĪdding a folder works in exactly the same way as with a file. Finally, hit return and the file should now show up in you Spotlight searches. Of course, if you know the path you can type it in manually yourself. Terminal should automatically type in the path to the file for you. Next, find the file you want to add in the Finder, and drag it onto the Terminal window. Type in mdimport and then hit the space bar. Start by opening up Terminal (located in Applications/Utilities). To manually add it to the index, you can use the following command. However, every now and again something goes wrong and a stubborn file might refuse to show up. ![]() In theory, all files are added to the Spotlight index when they are created. Here are a few Terminal commands for changing hidden Spotlight settings, performing more complicated searches and updating the index. Most of us have probably had a problem where Spotlight wonât find a file you know is there. Spotlight works great most of the time, but occasionally you may need to do a bit of tinkering to get it to work properly.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |