Spotlight is a great tool to search for files on your Mac, as it lets you quickly find a file no matter where it is saved. When the tool shows results, they are categorized for you to quickly get to the exact file you were looking for. While the search results are almost always the ones you wanted, sometimes you will see some developer files appearing there, and it is mostly because of Xcode. These developer files may not be of much use to you unless they were the ones you were trying to find.
Related: how to install command line tools without Xcode on your Mac
If you wish to not see these developer results when you search using Spotlight, there is a way to omit these results.
Omitting the Developer Search Results from Spotlight When Xcode Is Installed
If you have Xcode installed on your Mac, you can use the following steps to prevent its files from appearing in the Spotlight search.
1. Click on the Apple logo in the top-left corner of your screen and select “System Preferences…”
2. Click on “Spotlight” when the System Preferences panel opens.
3. When the Spotlight settings panel launches, click on the tab that says “Search Results.” That is where you can decide what results will appear.
On this panel what you need to do is uncheck the checkbox for “Developer.”
If you have uninstalled Xcode but the developer files still appear in the Spotlight search results, then you need to use the following steps to get rid of them.
Omitting the Developer Search Results from Spotlight When Xcode Is Not Installed
Since Xcode has been uninstalled from your Mac, you will not see the “Developer” checkbox which you saw in the above section. That means you cannot control the developer results that appear in Spotlight.
To tackle the issue what you need to do is create a dummy Xcode app file, and that will force the system panel to show the “Developer” checkbox which you can then uncheck.
1. Launch Terminal on your Mac.
2. When Terminal launches, type in the following command and press Enter. It will change your current working directory to “/Applications.”
3. Next, type the following command into Terminal and press Enter. It will create a new app file called Xcode which tricks your Mac into thinking that this is the real Xcode app.
4. You will not get a confirmation or anything in Terminal, but the job is done.
5. Click on the Apple logo in the top-left corner of your screen and select “System Preferences…” Then click on the option that says “Spotlight” followed by “Search Results.”
You should be able to see the “Developer” checkbox which was not shown before. Uncheck it and close the panel.
If you find developer files to be useless when you are looking for more important files using Spotlight, the guide above should help you stop those developer files from appearing in the search results.