7

I installed Emacs.app with Homebrew, and used brew linkapps to create an alias in my /Applications directory.

Since I updated to OS X Mavericks yesterday, Spotlight and Alfred can no longer see this alias.

Since discovering the problem, I've tried reindexing my MacBook as described here, as well as reinstalling Emacs and restarting the machine.

Any other suggestions?

4 Answers 4

10

For some reason, including /opt/homebrew/Cellar (the path to Homebrew's Cellar on Apple Silicon devices) in Alfred's Search Scope doesn't work, at least for Emacs.

But I found a more generic solution that should work for any application. The trick is to create an alias in /Applications to the application's .app dir/bundle, and then to tell Alfred to include macOS aliases in search results.

I use Homebrew-installed Emacs as an example below because generalizing the instructions would make the language awkward. Extending the example ought to be trivial.

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, this 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 the alias by Cmd+Opt 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 (alfred 4.7), navigate to Features > Default Results 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.

The alias will fail at every update that changes the versioned path to the app in the Cellar, which happens to be emacs-27.2-mac-8.3 at writing. The correct solution to the underlying problem is to fix Alfred so it picks up applications installed to /opt. A hacky alternative might be to hook into homebrew and recreate the alias when needed.

I'll probably manually recreate the alias each time it breaks so that the breakage can serve as a reminder to check for an upstream fix to the underlying problem.

1
  • 2
    It is necessary to make a Mac 'alias' and not a UNIX symbolic link. Both are labelled with "Kind: alias" in Finder. But they are different types apparently. The UNIX symbolic link is interpreted as a link to a directory (the .app file can be opened like a directory). Whereas the Mac alias interprets it as a link to an actual app.
    – Myridium
    Commented Dec 20, 2022 at 1:20
3

Found the answer here.

I needed to add the Homebrew cellar path to the list of paths under Features | Default Results | Search Scope, and then Alfred recursively scanned it and found Emacs.

On my Mac the path was /usr/local/Cellar.

And there was great rejoicing!

1
  • 1
    on a apple silicon Mac Book Pro as of 2021-12-13 my path was /opt/homebrew/Cellar
    – Johan
    Commented Dec 13, 2021 at 11:49
1

I actually came across this back in March with the release of Alfred 2 and documented my solution here: http://blog.victorquinn.com/alfred-2-and-emacs

Perhaps that'll help you.

2
  • 1
    Answers on Ask Different need to be more than just a link. It's okay to include a link, but please summarize or excerpt it in the answer. The idea is to make the answer stand alone and not fully rely on off-site information (which may disappear, similar to the first link in the page you are referring to).
    – nohillside
    Commented Nov 1, 2013 at 14:37
  • FYI: victorquinn.com uses an invalid security certificate. The certificate expired on 21 July 2016 at 16:03. Commented Sep 14, 2016 at 15:11
0

Alfred Preference >> Features >> Default Results >> Search Scope in Search Scope: Finder Folder Clicked and Just Drag and Drop! (not emacs.app but The parents Folder) enter image description here

Just Drag and Drop!!!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .