Jump to content

Alfred not finding Homebrew apps on M1 (/opt/homebrew)


mfisher

Recommended Posts

Hi!

 

I install Emacs from Homebrew. For years, Alfred has been able to find it. On the new M1 Macs, the Homebrew (v3) location is in /opt/homebrew.

 

Here's my Emacs.app:

% ls -lA /opt/homebrew/Cellar/emacs-plus@28/28.0.50| grep Emacs
drwxr-xr-x  3 mfisher  staff     96 Feb 14 11:51 Emacs.app

 

Per the recipe instructions, I did:

To link the application to default Homebrew App location:
  ln -s /opt/homebrew/opt/emacs-plus@28/Emacs.app /Applications

 

I added `/opt/homebrew/Cellar` into my Alfred search scope. But when I activate Alfred and type "emacs", Alfred doesn't find it.

 

Alfred v4.3.2 [1220]

macOS Version 11.3 Beta (20E5172i)

 

Thanks!

 

Alfred Preferences.jpg

Link to comment
Share on other sites

I went to take a look and noticed /opt/homebrew-cask/Caskroom is part of the defaults. That no longer makes sense, @Andrew, as anyone with their Caskroom on that location has a really old and unsupported installation which I doubt even works. And I agree /opt/homebrew/Cellar makes sense to add.

 

@mfisher Does Spotlight find that Emacs? Alfred depends on it.

Link to comment
Share on other sites

On 2/14/2021 at 6:52 PM, vitor said:

 

@mfisher Does Spotlight find that Emacs? Alfred depends on it.

 

@vitor It does not. Are there any clever ways to force indexing on a path? I tried Apple's procedure to rebuild a Spotlight index for /opt.

 

For the time being, I made a workflow to launch Emacs, so I am content again.

 

Thanks!

 

 

Starting Diagnostics...

File: 'Emacs.app'
Path: '/Applications'

-----------------------------------------------------------

Check file cache database...

File cache integrity is ok

-----------------------------------------------------------

Check if file is readable...

Alfred has permissions to read this file.

-----------------------------------------------------------

Check if volume '/' is indexed by macOS...

Indexing is enabled on this drive

-----------------------------------------------------------

Check direct file metadata...

Direct metadata available

Display Name: Emacs.app
 Other Names: 
Content Type: com.apple.application-bundle
   Last Used: 2021-02-14 16:51:11 +0000

-----------------------------------------------------------

Check mdls file metadata...

macOS metadata missing essential items

kMDItemFSContentChangeDate = 2021-02-14 16:51:11 +0000
kMDItemFSCreationDate      = 2021-01-10 01:11:39 +0000
kMDItemFSCreatorCode       = ""
kMDItemFSFinderFlags       = 0
kMDItemFSHasCustomIcon     = 0
kMDItemFSInvisible         = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery      = 0
kMDItemFSLabel             = 0
kMDItemFSName              = "Emacs.app"
kMDItemFSNodeCount         = 1
kMDItemFSOwnerGroupID      = 20
kMDItemFSOwnerUserID       = 501
kMDItemFSSize              = 1
kMDItemFSTypeCode          = ""

-----------------------------------------------------------

Troubleshooting failed
 

Edited by mfisher
Link to comment
Share on other sites

  • 11 months later...

I found a way to let Alfred open aliases to applications (that is, .app directories). Funny, my use case was also to get Homebrew-installed Emacs to show up. As a result, these instructions are for Emacs, but they should generalize to any .app alias.

 

First, create a macOS alias, not a symlink:

  • In Finder, press Cmd-Shift-g and use Tab auto-complete to enter the path of the directory containing Emacs.app (In my case, it is currently /opt/homebrew/Cellar/emacs-mac/emacs-27.2-mac-8.3)
  • Press Cmd-n to open a new Finder window, then Cmd-Shift-a to go to /Applications
  • Create an alias by Cmd-Option dragging Emacs.app from the homebrew window to the /Applications window.

Now, let's make Alfred include macOS aliases in search results:

  • Open Alfred's preferences, navigate to General > Default Results, and under Extras: click Advanced. A popup window will open that allows you to add file types that will be shown in search results.
  • Drag the Emacs.app alias from the Finder /Applications window to the popup window. The new entry should read com.apple.alias-file  |  alias

Close the popup and try searching for emacs. The result list should include the Emacs.app alias.

 

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

This still continues to be a problem. I'm not sure why even the Finder link is failing for me when I upgraded the app (I recreated the link with correct path, but it is not visible in the search results anymore). I wound up just creating custom workflow with the keyword I want + universal actions I want associated with the homebrew app (Emacs, in this case). This is somewhat unfortunate as this *used* to work fine. Would it be an option just to make some way to use non-spotlight search of specific paths possible or something? I don't really care if Alfred does it once when booting or once per day or something.

Link to comment
Share on other sites

  • 3 weeks later...

I'm running into this still. The workflow did not change anything. Neither Spotlight nor Alfred can see the emacs-plus alias in /Applications.

 

It's the only time I've ever run into Alfred not being able to find something. Strange!

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...