{"id":24385,"date":"2021-09-05T13:39:51","date_gmt":"2021-09-05T20:39:51","guid":{"rendered":"https:\/\/www.podfeet.com\/blog\/?p=24385"},"modified":"2021-09-05T15:01:49","modified_gmt":"2021-09-05T22:01:49","slug":"apple-apps-location-spotlight","status":"publish","type":"post","link":"https:\/\/www.podfeet.com\/blog\/2021\/09\/apple-apps-location-spotlight\/","title":{"rendered":"Apple Apps Aren\u2019t In Your Normal Applications Folder and Why You Might Care"},"content":{"rendered":"<figure style=\"float: right; margin-left: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2021\/09\/Applications-Folder-Showing-Apple-Apps.png\" alt=\"Applications Folder Showing Apple Apps\" title=\"#title#\" width=\"292 \" height=\"411\"><figcaption style=\"text-align:center\">Applications Folder Shows Apple Apps<\/figcaption><\/figure>\n<p>Did you know that Apple apps aren\u2019t REALLY in your top-level Applications folder with all of your other apps?<\/p>\n<p>If you open your Applications folder on your Mac using the Finder, you\u2019ll see all of your Apple apps intermingled with your third-party apps, but it turns out they\u2019re not really there!<\/p>\n<p>To prove what I\u2019m saying, we need to view files from the command line using the Terminal app. If you haven\u2019t used the Terminal before, don\u2019t be afraid as this will be very easy, I promise.  Terminal is inside the Utilities folder inside your Applications folder.<\/p>\n<p>We\u2019re going to change directory in Terminal to your \u201cnormal\u201d Applications folder. The command <code>cd<\/code> is short for change directory. Open Terminal, and simply type :<\/p>\n<p><code>cd \/Applications<\/code><\/p>\n<p>Now let&#8217;s list the files in this folder using the <code>ls<\/code> command:<\/p>\n<p><code>ls<\/code><\/p>\n<p>If you compare this list to the Finder view of your Applications folder, you\u2019ll see all of your third-party applications, but you won\u2019t find any of your Apple apps listed.<\/p>\n<figure style=\"float: center; margin: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2021\/09\/Main-Applications-Folder-Shows-No-Apple-Apps-in-Terminal.png\" alt=\"Main Applications Folder Shows No Apple Apps in Terminal\" title=\"#title#\" width=\"599 \" height=\"316\"><figcaption style=\"text-align:center\">Where is the App Store? Where are Automator and Books?<\/figcaption><\/figure>\n<p>You may have noticed that your Mac has another Applications folder under System. Let\u2019s change directory using our <code>cd<\/code> command to the System-level Applications folder.<\/p>\n<p><code>cd \/System\/Applications\u00a0<\/code><\/p>\n<p>Followed by:<\/p>\n<p><code>ls<\/code><\/p>\n<p>Well looky there, all of your Apple apps are in the System-level Applications folder!<\/p>\n<figure style=\"float: center; margin: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2021\/09\/Apple-Apps-in-System-Applications.png\" alt=\"Apple Apps in System Applications\" title=\"#title#\" width=\"506 \" height=\"197\"><figcaption style=\"text-align:center\">Here They Are &#8211; They&#8217;re Hiding in \/System\/Applications<\/figcaption><\/figure>\n<p>Isn\u2019t that curious?  I noticed this a long time ago and I thought about doing a writeup calling this \u201cFun Facts to Know and Tell\u201d, but recently I had an experience where knowing this gave me a clue to a problem I was having.<\/p>\n<h2>Why This Might Matter<\/h2>\n<figure style=\"float: right; margin-left: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2021\/09\/Drag-Drive-Into-Spotlight-Privacy.png\" alt=\"Drag Drive Into Spotlight Privacy\" title=\"#title#\" width=\"500 \" height=\"457\"><figcaption style=\"text-align:center\">Drag Drives Into Spotlight Privacy to Stop Indexing<\/figcaption><\/figure>\n<p>The problem I&#8217;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.<\/p>\n<p>Luckily, there&#8217;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\u2019s a tab for Privacy. This is where you put volumes or folders you don\u2019t want to be indexed by Spotlight. A good thing to put in there is your connected backup drive, so you don\u2019t start accidentally opening things via Spotlight in your backup.<\/p>\n<p>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.<\/p>\n<p>Unfortunately for me, this didn&#8217;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.<\/p>\n<h3>Call for Help<\/h3>\n<figure style=\"float: right; margin-left: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2021\/09\/man-Page-for-mdutil-Command.png\" alt=\"Man Page for mdutil Command\" title=\"#title#\" width=\"401 \" height=\"600\"><figcaption style=\"text-align:center\">man Page for the `mdutil` Command &#8211; *s for the Commands We&#8217;ll Use<\/figcaption><\/figure>\n<p>I didn&#8217;t have any other ideas, so I wrote to the Mac Geek Gab, and John F Braun suggested using <code>sudo mdutil -E \/<\/code> from the command line. In the terminal, you can view the manual for most commands, by typing in the word <code>man<\/code> 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 <code>man mdutil<\/code> and the manual told me:<\/p>\n<p>&#8221; mdutil &#8212; manage the metadata stores used by Spotlight&#8221;<\/p>\n<p>Fair enough, now what does the flag <code>-E<\/code> tell the <code>mdutil<\/code> command? The man page says:<\/p>\n<p>&#8220;-E  This flag will cause each local store for the volumes indicated to be erased.  The stores will be rebuilt if appropriate.&#8221;<\/p>\n<p>This sounded dandy except for the &#8220;rebuilt if appropriate&#8221; part. I want it _definitely rebuilt, but what the heck, I ran the command.<\/p>\n<p>Just like with dragging my disk into the privacy pane, the <code>mdutil<\/code> 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.<\/p>\n<p>I tested in other accounts on my system, and the problem wasn\u2019t there, but since I can\u2019t really work in those accounts for very long because my stuff isn\u2019t there, I don\u2019t think I really proved whether it was working or not.<\/p>\n<h2>And Then a Clue Arrived<\/h2>\n<p>After literally weeks of this problem, I got a new clue to the root cause. I noticed that it wasn\u2019t all apps that wouldn\u2019t launch when the problem was occurring, it was <em>only<\/em> the Apple-specific apps.<\/p>\n<p>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&#8217;s kind of an advanced topic so I won&#8217;t go into it here) and I didn&#8217;t see anything wrong.  So now I have this great clue, but what do I do with this information?<\/p>\n<h2>Reinstall macOS<\/h2>\n<figure style=\"float: right; margin-left: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2021\/09\/macos-big-sur-recovery-reinstall-macos.jpg\" alt=\"macOS Big Sur recovery reinstall macOS\" title=\"#title#\" width=\"240 \" height=\"221\"><figcaption style=\"text-align:center\">macOS Recovery Mode Reinstall<\/figcaption><\/figure>\n<p>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\u2019d typed. The pause was so long that often the words I typed after the caps word came out <em>before<\/em> 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&#8217;s 1946 typing school book, and if it was good enough for the Podmom, it&#8217;s good enough for me.<\/p>\n<p>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. <em>THAT<\/em> was unacceptable, and it was time for drastic action.<\/p>\n<p>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&#8217;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.<\/p>\n<p>This sounds like a terrifying task, but it&#8217;s actually really easy and doesn&#8217;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&#8217;t do this without a full backup, but in my experience, it hasn\u2019t been destructive and only fixes things.<\/p>\n<p>After the reinstall, not only did the SUPER annoying pauses go away, to my delight, Spotlight started doing its job properly.<\/p>\n<p>Until it forgot all about the Apple apps and started reindexing again.<\/p>\n<h2>AppleCare Phone Call of Sadness<\/h2>\n<figure style=\"float: right; margin-left: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2021\/09\/applecare_logo.jpg\" alt=\"Applecare logo\" title=\"#title#\" width=\"171 \" height=\"171\"><figcaption style=\"text-align:center\"><\/figcaption><\/figure>\n<p>It was time for the most drastic of solutions. I knew I had to call AppleCare. But I didn&#8217;t want to. I&#8217;m soooo tired of calling them.  I&#8217;m never happy afterwards.<\/p>\n<p>I procrastinated for a few weeks successfully only because of something I heard on the Mac Geek Gab.  I didn&#8217;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 &#8220;Launchpad&#8221; can launch apps.  But I didn&#8217;t know it could be invoked with Control-Space. That means it&#8217;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 <em>always<\/em> find my Apple apps when Spotlight has amnesia.<\/p>\n<p>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&#8217;d have to send me up to a senior tech, and then described pretty quickly the problem and everything I&#8217;d tried. Sam immediately said, &#8220;Yep, you&#8217;re going to a senior tech.&#8221;  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.<\/p>\n<p>Sam handed me off to Nicole, and she has been lovely as well. She quickly read Sam&#8217;s notes, we chatted a bit and she said, yeah, you&#8217;ve done everything I would have told you to do. Off to engineering for you.<\/p>\n<p>We all know that &#8220;off to engineering&#8221; is a euphemism for &#8220;wishing you into the cornfields&#8221; from that awesome episode of <a href=\"https:\/\/en.wikipedia.org\/wiki\/It%27s_a_Good_Life_(The_Twilight_Zone)\" target=\"_blank\" rel=\"noopener\">The Twilight Zone with Billy Mumy<\/a>.  It&#8217;s where tech problems go to die.<\/p>\n<p>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&#8217;s command line method but with a few more steps.<\/p>\n<blockquote><p>\n  Please have the customer open Terminal and run the following command:<\/p>\n<p>  sudo launchctl load -w \/System\/Library\/LaunchDaemons\/com.apple.metadata.mds.plist\n<\/p><\/blockquote>\n<p>Off to the man page for <code>launchctl<\/code> only to find the explanation &#8220;Interfaces with launchd&#8221;.  Ok, what&#8217;s <code>launchd<\/code>? Man page says &#8220;System wide and per-user daemon\/agent manager&#8221;.  That didn&#8217;t have a lot of meaning for me, so I dutifully ran the command.<\/p>\n<p>I got the response that the service in the command was already loaded so I guess I didn&#8217;t need to do that step.  The engineer&#8217;s next directions were to restart, make sure Time Machine isn&#8217;t running.  Then they told me to run almost the exact same command John F. Braun suggested.  This time they put the <code>sudo<\/code> command in front. <code>sudo<\/code> means &#8216;Super User Do&#8221; which escalates your privileges for the upcoming command.<\/p>\n<pre><code>sudo mdutil -Eai off\nsudo mdutil -Eai on\n<\/code><\/pre>\n<p>This is interesting, we used <code>mdutil -E<\/code> last time to cause each local store to be erased and rebuilt (if appropriate).  According to the man pages for <code>mdutil<\/code>, the <code>-a<\/code> means to apply the command to _all_stores on the volume, and <code>-i<\/code> allows you to add the on and off commands.<\/p>\n<p>They ended it with one last <code>mdutil<\/code> command:<\/p>\n<blockquote><p>\n  <code>mdutil -as<\/code>\n<\/p><\/blockquote>\n<p>The <code>-s<\/code> flag tells <code>mdutil<\/code> 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 <code>mdutil<\/code>, it showed me each of my volumes and said &#8220;indexing enabled&#8221; next to them, with the exception of my backup drive which said disabled instead.  That makes sense since I&#8217;ve purposely excluded it with the System Preferences pane trick.<\/p>\n<p>But later, when the system starts failing to find Apple apps again, I ran the status flag on <code>mdutil<\/code> again, and now it says that it&#8217;s <em>disabled<\/em>.  I&#8217;m not sure if that&#8217;s a clue or not but I&#8217;ve sent it off to engineering.<\/p>\n<figure style=\"float: center; margin: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2021\/09\/indexing-differences-whether-Spotlight-is-working-or-not.png\" alt=\"Indexing differences whether Spotlight is working or not\" title=\"#title#\" width=\"599 \" height=\"175\"><figcaption style=\"text-align:center\">Left: Indexing enabled when Spotlight is working, Right: Indexing disabled when Spotlight is confused<\/br> Note: my backup drive was attached in the left screenshot<\/figcaption><\/figure>\n<figure style=\"float: right; margin-left: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2021\/09\/Run-Spotlight-Diagnostics-from-Activity-Monitor.png\" alt=\"Run Spotlight Diagnostics from Activity Monitor\" title=\"#title#\" width=\"500 \" height=\"261\"><figcaption style=\"text-align:center\">Run Spotlight Diagnostics from Activity Monitor<\/figcaption><\/figure>\n<p>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.<\/p>\n<p>If you open Activity Monitor from your Utilities folder inside Applications (or using Spotlight if yours is functioning properly), there&#8217;s a little circle with three dots icon that when selected will let you run a Spindump, System Diagnostics, or Spotlight Diagnostics.<\/p>\n<p>It took a while to run, and created a <em>huge<\/em> bundle of text files, so there was no chance I&#8217;d be able to read and interpret it, but it&#8217;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 <em>was<\/em> working.<\/p>\n<p>Now I&#8217;m at the twiddle my thumbs again and wait stage, but at least I have the impression that they&#8217;re looking into it!<\/p>\n<h2>Another Instance Where Knowing This tip Was Helpful<\/h2>\n<p>This all started as a &#8220;fun fact to know and tell&#8221; about Apple&#8217;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.<\/p>\n<p>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&#8217;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&#8217;s in \/System\/Applications!<\/p>\n<p>See? I told you this was a handy thing to remember.<\/p>\n<h2>Bottom Line<\/h2>\n<p>The bottom line is that I think that knowing your Apple apps aren&#8217;t really in the &#8220;normal&#8221; 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.<\/p>\n<p>Also, I&#8217;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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Applications Folder Shows Apple Apps Did you know that Apple apps aren\u2019t 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\u2019ll see all of your Apple apps intermingled with your third-party apps, but it turns out they\u2019re not really [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":24376,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[147],"tags":[4778,459,230,572,4779,3226,229],"class_list":["post-24385","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-posts","tag-apple-apps","tag-applecare","tag-command-line","tag-diagnostics","tag-mdutil","tag-spotlight","tag-terminal"],"jetpack_featured_media_url":"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2021\/09\/Apple-Apps-in-System-Applications.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts\/24385","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/comments?post=24385"}],"version-history":[{"count":4,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts\/24385\/revisions"}],"predecessor-version":[{"id":24390,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts\/24385\/revisions\/24390"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/media\/24376"}],"wp:attachment":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/media?parent=24385"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/categories?post=24385"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/tags?post=24385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}