Did you know that Apple apps aren’t REALLY in your top-level Applications folder with all of your other apps?
If you open your Applications folder on your Mac using the Finder, you’ll see all of your Apple apps intermingled with your third-party apps, but it turns out they’re not really there!
To prove what I’m saying, we need to view files from the command line using the Terminal app. If you haven’t used the Terminal before, don’t be afraid as this will be very easy, I promise. Terminal is inside the Utilities folder inside your Applications folder.
We’re going to change directory in Terminal to your “normal” Applications folder. The command
cd is short for change directory. Open Terminal, and simply type :
Now let’s list the files in this folder using the
If you compare this list to the Finder view of your Applications folder, you’ll see all of your third-party applications, but you won’t find any of your Apple apps listed.
You may have noticed that your Mac has another Applications folder under System. Let’s change directory using our
cd command to the System-level Applications folder.
Well looky there, all of your Apple apps are in the System-level Applications folder!
Isn’t that curious? I noticed this a long time ago and I thought about doing a writeup calling this “Fun Facts to Know and Tell”, but recently I had an experience where knowing this gave me a clue to a problem I was having.
Why This Might Matter
The problem I’ve been having is that Spotlight keeps forgetting where my apps are. I launch Spotlight and type in Mail, and it shows me things like the Gmail app in the Mac App Store, instead of finding Mail on my drive. When this is happening, I also notice that Spotlight is indexing my drive. After a while it finishes and then I can launch apps again via Spotlight but then a few hours later it stops finding them and starts indexing again.
Luckily, there’s an easy trick to force a reindex, which I hoped would unconfuse Spotlight. The easiest way is to do it through the Spotlight System Preferences pane. In there’s a tab for Privacy. This is where you put volumes or folders you don’t want to be indexed by Spotlight. A good thing to put in there is your connected backup drive, so you don’t start accidentally opening things via Spotlight in your backup.
If you want to force Spotlight to reindex your drive, you simply drag your main drive into the Privacy tab for Spotlight which will stop the indexing. Close System Preferences, reopen it, and take the drive back out which will cause Spotlight to reindex the drive.
Unfortunately for me, this didn’t shake loose whatever was wrong, because my Mac continues to forget where the apps are, reindex on its own, find them, and then forget again.
Call for Help
I didn’t have any other ideas, so I wrote to the Mac Geek Gab, and John F Braun suggested using
sudo mdutil -E / from the command line. In the terminal, you can view the manual for most commands, by typing in the word
man followed by the command. Anything with a dash in front of it is called a flag, and these are described in a list within the manual. I typed in
man mdutil and the manual told me:
” mdutil — manage the metadata stores used by Spotlight”
Fair enough, now what does the flag
-E tell the
mdutil command? The man page says:
“-E This flag will cause each local store for the volumes indicated to be erased. The stores will be rebuilt if appropriate.”
This sounded dandy except for the “rebuilt if appropriate” part. I want it _definitely rebuilt, but what the heck, I ran the command.
Just like with dragging my disk into the privacy pane, the
mdutil command worked for a day or so and then the problem came back. I booted into Safe Mode to try to clear things out, but the problem came back. Why not try an SMC reset? It seemed to fix the problem too, but the problem came back. I then realized that simply rebooting fixes it temporarily.
I tested in other accounts on my system, and the problem wasn’t there, but since I can’t really work in those accounts for very long because my stuff isn’t there, I don’t think I really proved whether it was working or not.
And Then a Clue Arrived
After literally weeks of this problem, I got a new clue to the root cause. I noticed that it wasn’t all apps that wouldn’t launch when the problem was occurring, it was only the Apple-specific apps.
Since we know that the Apple apps are not in the /Applications folder and instead they live in /System/Applications, what if the permissions were borked on the Apple Applications folder? I looked at them using the Terminal (that’s kind of an advanced topic so I won’t go into it here) and I didn’t see anything wrong. So now I have this great clue, but what do I do with this information?
Around this time, I had a whole new problem on my Mac. The new entertainment was that when I used the caps lock key, my Mac would pause for up to two full seconds before continuing to finish what I’d typed. The pause was so long that often the words I typed after the caps word came out before the capitalized word. I know, many of you are yelling into your devices that the caps lock key is evil and I should disable it, but I learned to touch-type when I was a young child from my mother’s 1946 typing school book, and if it was good enough for the Podmom, it’s good enough for me.
While that was supremely annoying, I then realized that autocorrect caused the same 1-2 second lag. I may be a touch typist, but autocorrect is still my friend and now it was betraying me too. Then things really got bad because TextExpander snippet expansion was also plagued with the interminable lag. THAT was unacceptable, and it was time for drastic action.
My friend and Apple consultant Pat Dengler suggested it might be time for an over-the-top reinstall of the operating system. This is not a nuke and pave, it’s actually a very simple and quick way to replace the OS without any other bother. Think of it like lifting everything in your house up in the air, putting in new, but identical carpeting minus the stains you had, and then setting the furniture back down.
This sounds like a terrifying task, but it’s actually really easy and doesn’t take very much time. You simply boot into recovery mode, run the reinstall and it takes maybe an hour or so. Of course, don’t do this without a full backup, but in my experience, it hasn’t been destructive and only fixes things.
After the reinstall, not only did the SUPER annoying pauses go away, to my delight, Spotlight started doing its job properly.
Until it forgot all about the Apple apps and started reindexing again.
AppleCare Phone Call of Sadness
It was time for the most drastic of solutions. I knew I had to call AppleCare. But I didn’t want to. I’m soooo tired of calling them. I’m never happy afterwards.
I procrastinated for a few weeks successfully only because of something I heard on the Mac Geek Gab. I didn’t realize that you can use Launchpad to launch apps just like you can with Spotlight. Yeah, I hear how dumb I sound not realizing that something called “Launchpad” can launch apps. But I didn’t know it could be invoked with Control-Space. That means it’s just as easy as Spotlight, and all I have to do is retrain more than a decade of muscle memory. Interestingly enough, Launchpad can always find my Apple apps when Spotlight has amnesia.
It still bugged me that Spotlight was so broken for me, so I finally broke down and called Apple. I told Sam, the first-level tech that there was a 90% chance he’d have to send me up to a senior tech, and then described pretty quickly the problem and everything I’d tried. Sam immediately said, “Yep, you’re going to a senior tech.” Lovely that Sam did it quickly. Many times first-level techs have been amazing for me, but I was pretty sure this was going to be a tough one.
Sam handed me off to Nicole, and she has been lovely as well. She quickly read Sam’s notes, we chatted a bit and she said, yeah, you’ve done everything I would have told you to do. Off to engineering for you.
We all know that “off to engineering” is a euphemism for “wishing you into the cornfields” from that awesome episode of The Twilight Zone with Billy Mumy. It’s where tech problems go to die.
But in a crazy twist of events, engineering actually responded quite quickly. They sent a message back to Nicole to relay to me. They suggested something similar to John F. Braun’s command line method but with a few more steps.
Please have the customer open Terminal and run the following command:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
Off to the man page for
launchctl only to find the explanation “Interfaces with launchd”. Ok, what’s
launchd? Man page says “System wide and per-user daemon/agent manager”. That didn’t have a lot of meaning for me, so I dutifully ran the command.
I got the response that the service in the command was already loaded so I guess I didn’t need to do that step. The engineer’s next directions were to restart, make sure Time Machine isn’t running. Then they told me to run almost the exact same command John F. Braun suggested. This time they put the
sudo command in front.
sudo means ‘Super User Do” which escalates your privileges for the upcoming command.
sudo mdutil -Eai off sudo mdutil -Eai on
This is interesting, we used
mdutil -E last time to cause each local store to be erased and rebuilt (if appropriate). According to the man pages for
-a means to apply the command to _all_stores on the volume, and
-i allows you to add the on and off commands.
They ended it with one last
-s flag tells
mdutil to show the status of indexing by volume on the system. When I ran the status command right after doing the turn it off and back on again dance with
mdutil, it showed me each of my volumes and said “indexing enabled” next to them, with the exception of my backup drive which said disabled instead. That makes sense since I’ve purposely excluded it with the System Preferences pane trick.
But later, when the system starts failing to find Apple apps again, I ran the status flag on
mdutil again, and now it says that it’s disabled. I’m not sure if that’s a clue or not but I’ve sent it off to engineering.
The final instructions from engineering were to make sure to not launch any third-party apps until the indexing was done (which was very annoying) and to not run Time Machine either. Finally, when all was working again, they asked me to run a diagnostic on Spotlight.
If you open Activity Monitor from your Utilities folder inside Applications (or using Spotlight if yours is functioning properly), there’s a little circle with three dots icon that when selected will let you run a Spindump, System Diagnostics, or Spotlight Diagnostics.
It took a while to run, and created a huge bundle of text files, so there was no chance I’d be able to read and interpret it, but it’s cool that they have something to look at. I decided to run this diagnosis when Spotlight was misbehaving since it seemed uninteresting to give them when it was working.
Now I’m at the twiddle my thumbs again and wait stage, but at least I have the impression that they’re looking into it!
Another Instance Where Knowing This tip Was Helpful
This all started as a “fun fact to know and tell” about Apple’s apps only pretending they live in the normal Applications folder, but I actually ran into needing to know this tidbit a second time recently. In Programming By Stealth, Bart was teaching us how to tell our Terminal what our preferred text editor is. You can tell it to use one of the nerdy command line editors like vi or nano, which feels natural to me, or you can have a GUI app like TextEdit pop up when you ask to edit a file in the command line.
In my configuration dot file, I dutifully told it to point to an app I like called CotEditor, and it worked perfectly. But then I tried changing it to TextEdit, and asking to edit from the command line did NOT open TextEdit. That’s when I realized that since I was working at the command line, I was typing the full path to the app, and TextEdit is not in /Applications, it’s in /System/Applications!
See? I told you this was a handy thing to remember.
The bottom line is that I think that knowing your Apple apps aren’t really in the “normal” Applications folder is not only a fun fact to know and tell, it might also be a good piece of information to tuck away in the back of your brain just in case things get weird for you.
Also, I’ll let you know if Engineering from Apple ever lets me come back in from the cornfields so I can use Spotlight reliably ever again.
2 thoughts on “Apple Apps Aren’t In Your Normal Applications Folder and Why You Might Care”
Thanks for your great podcast!
As far as:
I also and having a similar problem with spotlight. Short Story – Like you – spotlight works for a few days then stops.
In anticipation of the new good M1-X MacBook pros – I recently sold my 2018 MacBook pros and returned back to my old 2012 MacBook Pro with High Sierra.
Basically I am having a similar problem as you describe in this podcast. Mine is even worse however. In my case, most or all my spotlight searches work for a few days and then stop, so this covers not only Applications as you mentioned but also my entire user folder (including mail smart folders).
First I would like to mention that when you described your terminal commands in searching for Apple apps versus third-party apps, this is not the case for me using High Sierra. I believe this APP separation is only in the newer operating systems and not in the older operating systems like High Sierra.
Anyway back to spotlight, a few weeks ago I tried most of the same things that you had mentioned such as:
– removing / adding the boot drive on the privacy tab in Preferences– Spotlight
– reinstalling High Sierra from the recovery partition
– then tried a few terminal commands – such as the ones you mentioned
– next Cocktail has a command to raise the Spotlight index and then rebuild it (probably like the terminal commands that do the same thing)
– and a few other things
The long and short of it, is that it seems that the spotlight index is somehow getting turned off every couple of days which seems exactly the same condition that you mentioned.
So at this point I’m also in the dark as to a solution. I’m very interested in finding out any updated info you may discover.
Thanks again for your great podcast
Thanks for sharing your experience, Dave. Very interesting that it’s happening back in High Sierra. I infer from your explanation that it’s not just Apple apps, and maybe it’s all of Spotlight that’s not indexing.
If engineering ever gets back to me on this, I’ll be sure to share. Thanks for the kind words about the show!