Mac Search Tools

Continuing the discussion from Best Practices for GUI Scripting:

@sphil et al:

I started a new topic about “Mac Search Tools” so we don’t continue to pollute the other topic.

I have to admit I am surprised how must interest and debate has been generated about the macOS Spotlight search tool. But since it seems to be so hot, let’s continue to discuss it here.

First, I think you completely missed my point about “powerful” varies according to the eyes of the beholder. :wink:

Maybe Spotlight is the same on both of our Macs (assuming we have the same macOS), but that is not the point. My point is how each us understand and use the tool, and what we expect of it. Every tool has its uses, benefits, and limitations. You wouldn’t try to extract a screw using s sledge hammer, would you? LOL But I would hope that you’d understand how powerful a sledge hammer can be. :wink:

So, to your request that I search for “csrutil”, I did just that and got this:

which I found very informative, but I’m guessing that you were expecting it to launch the Terminal command-line tool csrutil. I was not expecting that.

However, I did find lots of great info about it from a variety of sources:

  • Wikipedia
  • Your LNS post that I got in my Outlook email
  • Discussion about it on StackExchange
  • Several of my Evernote Notes where I had referenced the command

All of this came up instantly (<< 1 sec). I view this as very powerful because with one simple command I found a number of valuable, relevant resources, all without having to use multiple search tools/apps.

Now, about the “eye of the beholder”. I’m guessing that you use Terminal and shell scripts a lot. So you might expect Spotlight to give you info about all of the many bash commands. I don’t think Spotlight was designed for that because (and I’m just guessing here) most users don’t need and don’t user Terminal commands. If you do, then you already know about other sources that document all of these commands.

So, if “in your eyes” you don’t find the info that Spotlight provides, then that’s fine. Don’t use it. Perhaps you don’t find it powerful, but I and others do.

BTW, both @ShaneStanley and @ccstone have published several very power ASObjC search scripts for finding files/folders. I use those tools when I have that specific need.

One final note. Several people have mentioned that HoudaSpot uses the Spotlight index, but eliminates a number of Spotlight limitations. I plan to check it out.

This particular bugaboo is easy to overcome in Spotlight, but you have to know how.

That’s using the Spotlight search engine in Finder, and yes, of course, there are ‘advanced search’ options there. But the thing about using those is one has to already know that what you’re looking for won’t be found by a normal Spotlight search.

I was assuming (and referrring to) using the Spotlight UI that is typically enacted by Command-Space or by clicking the Spotlight icon in the Status menu bar.

No. The context of my point then was not about launching apps but about finding files on the local machine. As I already said in the other thread, there’s at least two files on your mac with ‘csrutil’ in the name that Spotlight will not find (wherein by ‘Spotlight’ I’m NOT referring to doing an advanced search in the Finder when one already knows what exceptions one is looking for).

On the other hand, this is what I would expect anything referred to as ‘a powerful search tool’ on my mac to return for ‘csrutil’ – less than 1 second also :slight_smile: ).

Well, actually, I was mistaken in saying that. What you’re seeing is country-specific. Spotlight since Yosemite returns results that may be different depending on your location.

I live in Thailand. I don’t get those results (thankfully) because some of the services they rely on are not available outside of the US and few other select countries.

When your search engine decides for you what you can see based on your location or, indeed, any other criterion that you don’t specifically control yourself, that’s my definition of a ‘crippled’ search engine.

Hey Phil,

Spotlight is Spotlight, so one needs to to make the distinction.

Some people think the Finder search is separate from Spotlight, but as you know that isn’t the case.

You and I are in agreement about the various stupidities of Spotlight, so we need not go into that much further.

It used to be possible to use the keyword filename:<string> and have the basic Spotlight UI find system files, but Apple in their infinite wisdom broke that in Yosemite (IIRC).

-Chris

I think “crippled” is harsh and inaccurate.

Again, every tool has its benefits and limitations.
The key to working any job effectively is to identify the proper tool to use.
If you only want a file search, and for it to include all files, then use your SuperSearch tool.
If you want to search for a broader set of items, and have the tool use some intelligence about filtering out less useful results, then use a tool like Spotlight, and maybe better HoudaSpot.

I’m not sure why there is such a rant against Spotlight. No is is forcing you to use it.
AppleScript has many limitations and quirks. I could go on ad nauseam complaining about these, but for no benefit. We have learned how to workaround these by using enhancements like scripting additions and script libraries, and of course, ASObjC.

So I’ll continue to use Spotlight (or maybe HoudaSpot) because it works well for me for many of the tasks I use it for. For a more file-focused search, I use Finder search (which is based on Spotlight), but with lots of help in selecting filters.

It works for me in macOS 10.11.6 using the syntax:
name:<characters in file name>

You can see this in the Finder search menu:

Hey JM,

Were you able to find csrutil using that methodology?

What I said:

-Chris

Good point. I didn’t get that you were connecting the filename: syntax with system files. I don’t know if filename: qualifier still works the same, just that now name: will filter for file names.

Spotlight couldn’t find the csrutil file, but Finder could, provided you searched from the /usr folder.

So, knowing that, if I needed to search for files like csrutil, I could just add the /usr or /usr/bin folder to my Finder Favorites.

OR

As you stated in the other thread:

If I was going to often search for system files, I’d probably create a Finder Saved Search for it.

OR

Just use HoudahSpot. :smile:

The point of the csrutil example was not to say “you can’t find it if you jump through a few hoops”, but that Spotlight (ie., the system wide UI tool in the menu bar, not the advanced Spotlight filter bar in Finder) won’t find it. Period.

If I use find in Terminal, I can find csrutil. If I use locate in Terminal, I can find csrutil; if I use mdfind in Terminal I can find csrutil; if I use Spotlight, I can’t.

QED, Spotlight is a crippled search tool.

   $ locate csrutil
    /System/Library/LaunchDaemons/com.apple.csrutil.report.plist
    /usr/bin/csrutil

Edit: about my use of the term ‘crippled’: it was a deliberate choice to reflect the fact, as noted above, that mdfind (and NSMetadataQuery) both can find things like csrutil, which means that the file is indexed by mds, the engine behind Spotlight, but that Apple have coded Spotlight deliberately not to return System and certain other files (that by the way, isn’t an inference; I was told so by an Apple engineer).

These two images are illustrative:

Sorry, I completely disagree. A tool that has a specific design criteria and/or goal is not crippled just because you disagree with the design.

I could call your “SuperSearch” crippled because it does not show any other document types like Evernote, Outlook, Wikipedia, etc. But I don’t. It simply has a different design objective.

I notice that you have ignored all of my statements about picking the proper tool for the job. You seem to want to keep complaining that a sledge hammer can’t extract screws. LOL

Just in case you haven’t figured it out yet, Spotlight is NOT designed to find every file on your hard drive. Use other tools for that job.

Jim, we got into this because I said “it’s quick but not very powerful” and you disagreed. I’ve ignored all your examples because a powerful search tool should find things on my mac. Spotlight doesn’t search my whole mac, and it doesn’t return all the files that exist in places it does search.

But we’re going round in circles and probably just annoying the hosts. I think we’ve both made our point. Let’s leave it here.

That’s why I suggested about 10 posts ago that we just agree to disagree. :wink:

Hey Guys,

People who want to have the last word never shut up.

Someone has to man-up and be the first one to shut-up…

:sunglasses:

-Chris

1 Like

Phil,

I’ve been in some kind of programming for almost 40 years and if there is one thing I have learned the best tool for the job is very much affected by personal preference. And that changes from person to person. Spotlight is good enough for a very, very large section of people who are looking for data on their Mac. It has been a very long time since spotlight couldn’t find what I was looking for. Of course if I have something I want to find later I put it where spotlight can find it. There are lots of way to get something indexed that normally wouldn’t get indexed. But I do this because of my personal preferences. If your preference to put data where you want to put it and you need a search that finds it there then that is your preference. It is not right or wrong. It’s just a preference.

I am really big on searching data so I make concessions to make data easier to find and as a result I am almost always able to find what I am looking for. This is why I have worked with databases since right out of high school. It is a really big thing to me. This is a personal preference of mine. Jim has preferences that are different then both of ours. What this all comes down to is you can’t convince Jim your right because you’re looking for different things then Jim is. One way satisfies your needs better and another satisfies Jim’s needs better. You both are right about your preferences so you are bother right.

I made a joke about spot light to lighten the mood a while back and it just seemed to annoy you so I haven’t said anything since. Both you and Jim have great ideas about searching. If you both shared your ideas and agree on strengthens and weakness in both methods people could learn a lot about searching from both of you.

It is something to think about. You are both right for a given individual. That’s all there is to it.

Bill

Seriously, guys, this is a great topic (Mac Search Tools) and deserves to be explored with substance and examples. This pissing contest is counter productive.

I’ve been looking at this topic every day for good information about how to craft an applescript method to do specific searches but this is all I get.

:disappointed:

I agree. Please stop this NOW and lets move on…

My apologies to all for my contribution to the above needless debate.
It is over, as far as I’m concerned.

However, I would like to provide some information about Spotlight that I think will be useful to those interested in, or thinking about, Spotlight.

###Spotlight Info

Spotlight is far, far more than a file search tool. And, we know that it will not find some system files. But it really makes searching for a broad range of things easy, right at your fingertips. I went for years ignoring Spotlight, then using it to launch apps, and finally to trying to take full advantage of what it offers.

I hope you find this useful.

1 Like

Being the author of one (rather successful) search tool for the Mac, I am a tiny bit miffed no one mentioned it. But instead of whining let me just make this shameless plug :wink:

Find Any File is based on the original Mac OS’s “Find File” tool, looking for all kinds of file properties (name, size, dates) but not content (that’s in the works, but it won’t be as good as Spotlight’s, but rather like EasyFind’s or the “grep” command’s). It can search entire disks rather fast because it uses the little known “CatalogSearch” function available only on HFS(+) and AFP volumes.

And my app can even search with root permissions (no other tool does that), like a “sudo find” command, allowing you to find even files that are normally inaccessible to you.

Of course, it’s no replacement for Spotlight, but it does some things better, especially if you look for files by name in areas where Spotlight never looks (e.g. in the areas marked Private in Spotlight’s Preferences).

The only thing it can’t yet do is being scriptable. I am considering adding that, now that I wrote my own scriptability framework last year (with great help from the kind Latenightsw devs).

2 Likes

Hey Thomas,

If it makes you feel any better I’ve used Find Any File since it became publicly available – and I own a couple of licenses for the shareware version.

Maybe the best $6.00 software purchase I’ve ever made.

I usually start a search with Spotlight.

If I don’t find what I want I move to HoudahSpot (which employs Spotlight).

If I don’t find what I want I move to Find Any File.

If I don’t find what I want (or want more sophisticated options) I move to File Buddy.

-Chris

2 Likes