homebrew-emacs-plus icon indicating copy to clipboard operation
homebrew-emacs-plus copied to clipboard

App alias doesn't show up in Spotlight

Open verhovsky opened this issue 9 months ago • 4 comments

Is it really impossible to install Emacs.app into /Applications/Emacs.app directly? I install like this on macOS 15.3.1:

brew install emacs-plus@30 --with-modern-doom3-icon
osascript -e 'tell application "Finder" to make alias file to posix file "/opt/homebrew/opt/emacs-plus@30/Emacs.app" at posix file "/Applications" with properties {name:"Emacs.app"}'

and when I open Spotlight with Cmd+Space, and type "emacs", it doesn't show up. I have to scroll all the way down and it's under "Other", effectively adding like 3-4 seconds to Emacs's startup time. Does it really need to be installed into /opt/homebrew/opt/emacs-plus@30/Emacs.app and aliased? If you make a symlink with ln -s it doesn't show up at all.

verhovsky avatar Mar 05 '25 02:03 verhovsky

it doesn't show up. I have to scroll all the way down and it's under "Other"

So it does show after all :) you just have to scroll. But I agree that it's not convenient. I guess the way spotlight searches for applications changes from macos version to version hence what worked before doesn't work well today 🤷

And just for visibility, as I commented in PR, you can simply copy/move the .app file to /Applications or ~/Applications.

effectively adding like 3-4 seconds to Emacs's startup time

Not sure about that, but could be related to code signing, which we do not perform. Don't remember where, but I've read either in Emacs+ issue tracker or somewhere on reddit about a workaround.

d12frosted avatar Mar 06 '25 20:03 d12frosted

you can simply copy/move the .app file to /Applications

And like I said, while this works initially it doesn't work with Doom Emacs, to reproduce (on an ARM64 Mac, Intel Macs have a different homebrew path):

brew install emacs-plus@30 --with-modern-doom3-icon
git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.config/emacs
~/.config/emacs/bin/doom install

mv /opt/homebrew/Cellar/emacs-plus@30/30.1/Emacs.app /Applications/Emacs.app
~/.config/emacs/bin/doom sync

You will get this error:

/opt/homebrew/bin/emacs: line 2: /opt/homebrew/Cellar/emacs-plus@30/30.1/Emacs.app/Contents/MacOS/Emacs: No such file or directory
/opt/homebrew/bin/emacs: line 2: exec: /opt/homebrew/Cellar/emacs-plus@30/30.1/Emacs.app/Contents/MacOS/Emacs: cannot execute: No such file or directory

This is because

$ which emacs
/opt/homebrew/bin/emacs
$ ls -al $(which emacs)
l-wxr-xr-x 1 boris admin 38 Mar  4 20:48 /opt/homebrew/bin/emacs -> ../Cellar/emacs-plus@30/30.1/bin/emacs
$ cat $(which emacs)
#!/bin/bash
exec /opt/homebrew/Cellar/emacs-plus@30/30.1/Emacs.app/Contents/MacOS/Emacs "$@"

If you change the file and try again

sudo chmod +w /opt/homebrew/Cellar/emacs-plus@30/30.1/bin/emacs
sed -i '' 's|/opt/homebrew/Cellar/emacs-plus@30/30.1/Emacs.app/Contents/MacOS/Emacs|/Applications/Emacs.app/Contents/MacOS/Emacs|' /opt/homebrew/Cellar/emacs-plus@30/30.1/bin/emacs
sudo chmod -w /opt/homebrew/Cellar/emacs-plus@30/30.1/bin/emacs
~/.config/emacs/bin/doom sync

... it actually works? Before I got a really long error. Well, at the very least changing that file to fix the emacs command needs to be part of the instructions.

could be related to code signing

I meant this process makes it take that long to click to open the app.

verhovsky avatar Mar 06 '25 22:03 verhovsky

You will get this error:

Use cp -r instead of mv.

I meant this process makes it take that long to click to open the app.

Ah, wasn't clear, I thought the initialisation of Emacs take more time.

d12frosted avatar Mar 07 '25 07:03 d12frosted

I still think that if you want to do it correctly just cp -r is not enough. You at least have to edit /opt/homebrew/Cellar/emacs-plus@30/30.1/bin/emacs and there's probably other files in /opt/homebrew/Cellar/emacs-plus@30/30.1/ that need to be updated though.

verhovsky avatar Mar 08 '25 10:03 verhovsky