Jump to content

Alfred won't index MacVim.app (installed via Homebrew)


TheBloke

Recommended Posts

I have MacVim installed via Homebrew.  This currently installs MacVim.app as /usr/local/Cellar/macvim/8.0-145/MacVim.app.  This directory is then symlinked to /usr/local/opt/macvim such that /usr/local/opt/macvim/MacVim.app is always pointing to the latest version.   /usr/local/opt/macvim/MacVim.app is then further symlinked to /Applications/MacVim.app, meaning I always have an /Applications/ link to the latest version of MacVim.app.

 

The problem is that Alfred does not detect /Applications/MacVim.app as an app - it never appears in the search results.   I don't know if this has always been the case or not.  However up until tonight I was able to open MacVim via Alfred,  because it had in its cache /usr/local/Cellar/macvim/8.0-144/MacVim.app (the true location of the version I previously had installed.)   Sure enough, I see /usr/local/Cellar is in my Alfred search scopes  I don't know if this was added by default, or if I added it myself years ago.

 

But I've now removed that old MacVim version, and Alfred is not now picking up the new install (/usr/local/Cellar/macvim/8.0-140/MacVim.app) even though  /usr/local/Cellar is in my search path.

 

I even tried adding /usr/local/Cellar/macvim, /usr/local/opt and /usr/local/opt/macvim as further search scope entries, but this didn't help.

 

I then even added  /usr/local/Cellar/macvim/8.0-145 to Search Scopes, so now the exact directory that contains MacVim.app is in scopes and it still won't appear!

 

I am not sure if Alfred actually follows App symlinks.   Another example of a Homebrew symlink is /Applications/IDLE.app which links to /usr/local/opt/python/IDLE.app, where /usr/local/opt/python is a link to /usr/local/Cellar/python/2.7.14_3.   Alfred does show IDLE, but it shows it on the latter link, in Cellar.   But then I tried removing /usr/local/Cellar from my scopes, and Alfred still shows IDLE (even after closing and reopening), suggesting it must be following the /Applications symlink, even though it shows it at its real location, not the symlink it (presumably) found it via?

 

That's good.  But in the MacVim case, it still won't pick it up at alll, whether by /Applications or a direct search scope of /usr/local/Cellar, /usr/local/Cellar/macvim or even /usr/local/Cellar/macvim/8.0-145.   So clearly there's something it doesn't like about this MacVim.app - but what?

 

Something's changed at some point, given it previously picked up /usr/local/Cellar/macvim/8.0-144/MacVim.app but won't now pick up /usr/local/Cellar/macvim/8.0-145/MacVim.app.  And no symlinks are involved there at all.

 

I have confirmed that /usr/local/Cellar/macvim/8.0-145/MacVim.app has the UTI of com.apple.application-bundle.  And of course it opens fine when double-clicked from Finder/Path Finder.

 

Thanks.

 

Directory listings:

tomj@Marvin ~ $ ls -al /Applications/MacVim.app                                                                      
lrwxr-xr-x  1 tomj  admin    32B 21 Feb 03:52 /Applications/MacVim.app -> /usr/local/opt/macvim/MacVim.app
tomj@Marvin ~ $ ls -al /usr/local/opt/macvim                                                                         
lrwxr-xr-x  1 tomj  admin    24B 21 Feb 03:51 /usr/local/opt/macvim -> ../Cellar/macvim/8.0-145

# no symlinks involved in the /usr/local/Cellar/macvim/* paths
tomj@Marvin ~ $ ls -ald /usr/local/Cellar                                                                            
drwxr-xr-x  86 tomj  admin   2.7K 21 Feb 01:38 /usr/local/Cellar
tomj@Marvin ~ $ ls -ald /usr/local/Cellar/macvim                                                                     
drwxr-xr-x  3 tomj  admin    96B 21 Feb 03:51 /usr/local/Cellar/macvim
tomj@Marvin ~ $ ls -ald /usr/local/Cellar/macvim/8.0-145                                                             
drwxr-xr-x  8 tomj  admin   256B 21 Feb 01:27 /usr/local/Cellar/macvim/8.0-145

tomj@Marvin ~ $ ls -al /usr/local/Cellar/macvim/8.0-145                                                               
total 32
drwxr-xr-x   8 tomj  admin   256B 21 Feb 01:27 .
drwxr-xr-x   3 tomj  admin    96B 21 Feb 03:51 ..
drwxr-xr-x   3 tomj  admin    96B 21 Feb 01:27 .brew
-rw-r--r--   1 tomj  admin   896B 21 Feb 01:27 INSTALL_RECEIPT.json
drwxr-xr-x   3 tomj  staff    96B 21 Feb 01:27 MacVim.app
-rw-r--r--   1 tomj  staff   747B 18 Feb 03:55 README.md
-rw-r--r--   1 tomj  staff   4.8K 18 Feb 03:55 README.txt
drwxr-xr-x  15 tomj  admin   480B 21 Feb 01:27 bin

tomj@Marvin ~ $ ls -al /usr/local/Cellar/macvim/8.0-145/MacVim.app                                                   
total 0
drwxr-xr-x  3 tomj  staff    96B 21 Feb 01:27 .
drwxr-xr-x  8 tomj  admin   256B 21 Feb 01:27 ..
drwxr-xr-x  9 tomj  staff   288B 21 Feb 01:27 Contents

tomj@Marvin ~ $ ls -al /usr/local/Cellar/macvim/8.0-145/MacVim.app/Contents                                          
total 136
drwxr-xr-x   9 tomj  staff   288B 21 Feb 01:27 .
drwxr-xr-x   3 tomj  staff    96B 21 Feb 01:27 ..
drwxr-xr-x   4 tomj  staff   128B 21 Feb 01:27 Frameworks
-rw-r--r--   1 tomj  staff    64K 21 Feb 01:27 Info.plist
drwxr-xr-x   3 tomj  staff    96B 21 Feb 01:27 Library
drwxr-xr-x   5 tomj  staff   160B 21 Feb 01:27 MacOS
-rw-r--r--   1 tomj  staff     8B 21 Feb 01:27 PkgInfo
drwxr-xr-x  94 tomj  staff   2.9K 21 Feb 01:27 Resources
drwxr-xr-x  11 tomj  staff   352B 21 Feb 01:27 bin

 

Edited by TheBloke
Link to comment
Share on other sites

@TheBloke Alfred doesn't index symlinks, but adding the path location of MacVim app to Alfred's search scope under Features > Default Results should be sufficient.

 

Make sure that you then type "reload" into Alfred to refresh the application cache once you've added the new search scope and the app should appear in results :)

 

If the app isn't being returned once it's in the scope, try performing an mdls on the MacVim app to make sure its metadata is complete.

 

Cheers,
Vero

Link to comment
Share on other sites

I have restarted Alfred multiple times, and I just ran a reload as well, and it's still not picking up /usr/local/Cellar/8.0-145/MacVim.app despite /usr/local/Cellar/8.0-145 being directly in the Search Scopes

 

I've tried mdls but it says it can't find any App I try it with - I don't know if i'm running it right?

 

tomj@Marvin /usr/local/Cellar/macvim/8.0-145 $ mdls /usr/local/Cellar/macvim/8.0-145/MacVim.app                     
/usr/local/Cellar/macvim/8.0-145/MacVim.app: could not find /usr/local/Cellar/macvim/8.0-145/MacVim.app.

 

tomj@Marvin /usr/local/Cellar/macvim/8.0-145 $ mdls /Applications/Alfred\ 3.app                                     
/Applications/Alfred 3.app: could not find /Applications/Alfred 3.app.
 

But I mentioned before that I did a Get Info and the MacVim.app shows the right UTI bundle information, and of course works when double-clicked in Finder.

 

Actually, I just realised that since I ran 'reload', Alfred can't find anything!    Or at least, any apps.  Something is very wrong, I can't load any app at all now

 

eTbsrGO.png

 

Here are my scopes:

 

9AWYl0X.png

 

Edited by TheBloke
Link to comment
Share on other sites

@TheBloke As per the help knowledge base, you need to put the entire path in quotes.

 

Not to worry, the easier way is to download the Alfred Metadata Tool below and drag your MacVim app onto it. This will show you the metadata, and you'll be able to paste it in your reply here so I can take a look :) 

 

https://cachefly.alfredapp.com/tools/AlfredMetadataTool_v1.1.zip

 

Cheers,
Vero

Link to comment
Share on other sites

Hi Vero

 

Did you see the second half of my post?  Right now I have no apps at all indexed in Alfred.  Since I ran 'reload', no App or PrefPane is in Alfred's cache, including all my usual apps in /Applications/

 

I downloaded your MetaData tool and ran it on /Applications/iTunes.app, and it said exactly the same thing as on the command line:

 

kgzdusc.png

 

Is something broken on my OS?  

Link to comment
Share on other sites

I think I know what it is.  Yesterday I disabled all Spotlight indexing by adding my system drive to the exclusion list.

 

Mdls sounds like a spotlight command. If you rely on spotlight to check metadata,it won't work if spotlight is completely disabled.

 

I will test this when I'm back on the computer.

 

If true it's annoying that it's required to keep spotlight running just for alfred to work, I disabled spotlight because I have alfred.

 

Unless alfred hasn't implemented it's own indexing because it relies on spotlight?

Link to comment
Share on other sites

Rather than maintain its own index (which would be less efficient), Alfred relies on the macOS index, so you'll need to keep the metadata indexing in order to find files using Alfred.

 

Is there any reason in particular you want to switch off Spotlight indexing? On modern versions of macOS, once the first indexing has been done, it uses very little CPU. You may also find that numerous other apps rely on the Spotlight indexing for presenting you with results and may not work as expected with indexing turned off.

 

You can disable or change the Spotlight hotkey if you just want to avoid seeing its search window in the system prefs > Spotlight.

 

Cheers,
Vero

Link to comment
Share on other sites

Yeah, after I re-enabled spotlight, all my apps reappeared in Alfred. 

 

I also have had huge cpu usage from spotlight processes constantly since I enabled it, which was the reason I disabled it in the first place. Maybe they will go away in time, but I had them for hours yesterday so I disabled spotlight because I thought why bother indexing things in spotlight when I exclusively use Alfred.. 

 

OK I will just have to hope that the high cpu from spotlight goes away, or that I can diagnose its cause separately.  I hadn't noticed it before yesterday when suddenly it became really bad, so maybe the indexes got damaged yesterday and it will just take a whole to rebuild then it will be OK.  I did have a couple of unexpected reboots yesterday so I suppose that may have triggered something. 

 

Thanks 

Edited by TheBloke
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...