-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Emacs formula: Emacs.app can't be found via Spotlight #4635
Comments
There is an external command "brew linkapps" that might help: |
This isn't exactly helping for Spotlight - looks like it doesn't want to follow symbolic links :| |
The answer might be "I don't know"; I don't personally use Spotlight. "Path Finder"'s app launch will work through symlinks, though (I filed a bug report and the author fixed it.) |
Maybe try asking the Spotlight question at the Apple stackoverflow: http://apple.stackexchange.com/ |
You can use 'mdimport /usr/local' to have Spotlight index /usr/local. Might be worth it to put this in the caveats for the emacs formula Here's a link to to the Apple developer page for mdimport |
Maybe consider |
This is also the case for launchbar. Launchbar doesn't see the symlinks so I end up copying the full apps. |
No, mdimporting /usr/local doesn't work - I'm guessing /usr/local is explicitly filtered out, either from import or from serving. Perhaps we just need |
Hm, maybe it's possible to make a Finder alias? That seems to work here, even if Spotlight shows the match as a Document and not an Application ... I don't know how to make a Finder alias in CLI/from bash, though ... |
Having spent a time looking for a solution to this the best quick fix is to make a shell script that invokes emacs, something as simple as
then use appify http://git.abackstrom.com/appify.git to make an app out of the script. Place this in /Applications and it will appear in Spotlight. |
So far, the best solution that has worked for me is to copy the app into the applications directory: cp -r /usr/local/Cellar/emacs/24.2/Emacs.app /Applications/ Spotlight then finds it with no trouble. |
I created an application via Automator which runs this shell script:
I put that application in ~/Applications/ and added an icon. |
|
Another possibility is to add an option to |
I have the same problem both a symlink and a Finder alias don't work, Spotlight still doesn't see the app. Only copying the app from the Cellar directory to /Applications works. The funny thing is that applications installed using Cask, which are symlinked from /opt/homebrew-cask/Caskroom into /Applications, appear fine in Spotlight. Any ideas why? |
Folks: we're aware this is an issue lots of people have and are annoyed about. Saying it affects you too won't really get it fixed quicker as it's not a pain point for the maintainers who are working on other things. People need to submit PRs instead. |
If the Cask are handling this fine, perhaps someone interested in this issue could take a look at that code and port it for Homebrew's usage too. Ultimately, It's easier to say 'Yes' to a working PR than it is to open-ended pondering, as much as I personally adore the latter 😉 |
/usr is flagged as hidden, but /opt is not. Spotlight refuses to index hidden folders or symlinks to hidden folders. A potential workaround would be to have Homebrew's Cellar be in /opt/homebrew/Cellar or something. |
@elyscape thanks! Your comment gave me the clue I needed for how to solve this problem:
After running this command, the Emacs symlink gets properly indexed by Spotlight. |
@zzamboni just mv the built Emacs.app into /Applications/ Don't be afraid nothing averse will happen, and you won't need to play with anything to make spotlight happen, it will just work. |
TL:DR not sure how spotlight makes the sausage :-) symlinking Emacs.app under so i copied but then - when i deleted the app when we have a symlink, spotlight will give a "Top Hit" as Emacs but copying over the Emacs.app gives consistent results running for not sure what magic this is :-) did not try marking |
@deepak: see my comment above. Marking |
On 10.11 El Capitan, the
|
Yes, rootless blocks it. You'd have to temporarily drop out of rootless to set the flag at this point. |
@DomT4 you have an idea of how I can do it? |
Hey, I found a way to link emacs app. When you use OS X' own alias system (right click > make alias), spotlight can find your file. So the issue was how can I do this kind of alias from terminal. I fond an answer here: http://apple.stackexchange.com/a/51712/38165 and I adapted the script as follows:
I named this script
I think |
PSA : Bundles are not intended compilation targets of brew. In fact the core Brew team very much prefer them not to be included in the formula list. There is also no reason to keep your Bundle in the Cellar. Dependencies are all met regardless of where you place the bundle. There are a number of files required that are not in the Bundle, but that is an issue with the formula which should be addressed elsewhere. Just as you would any other .app bundle you build, simply move Emacs.app into /Applications/ and don't waste your time fumbling around with symlinks, aliases or any other shenanigans. Better still use the downloadable build (as per brew cask) and move that bundle to /Applications/. This is yak shaving you can simply avoid, and Emacs will be indexed as a first class App.
|
I'm not sure if that's true, since we pass If you want a really portable Emacs bundle built from the core formula (since I don't think the Cask version has options like gnutls and imagemagick), this should work (keep in mind it's completely unsupported by us): diff --git a/Library/Formula/emacs.rb b/Library/Formula/emacs.rb
index 71f272e..ca2e0c3 100644
--- a/Library/Formula/emacs.rb
+++ b/Library/Formula/emacs.rb
@@ -87,14 +87,12 @@ class Emacs < Formula
system "./autogen.sh" if build.head? || build.devel?
if build.with? "cocoa"
- args << "--with-ns" << "--disable-ns-self-contained"
+ args << "--with-ns"
system "./configure", *args
system "make"
system "make", "install"
prefix.install "nextstep/Emacs.app"
- # Replace the symlink with one that avoids starting Cocoa.
- (bin/"emacs").unlink # Kill the existing symlink
(bin/"emacs").write <<-EOS.undent
#!/bin/bash
exec #{prefix}/Emacs.app/Contents/MacOS/Emacs "$@"
@@ -116,13 +114,6 @@ class Emacs < Formula
system "make"
system "make", "install"
end
-
- # Follow MacPorts and don't install ctags from Emacs. This allows Vim
- # and Emacs and ctags to play together without violence.
- if build.without? "ctags"
- (bin/"ctags").unlink
- (man1/"ctags.1.gz").unlink
- end
end
def caveats |
Oh... I didn't know bundles weren't necessary in the Cellar. I thought some dependencies used the |
This is what I was referring to re: address in another issue. Regardless, it makes no difference to where the .app bundle lives. The canonical location is /Applications/ and so that will get you best results re:OS X but as I said, a self contained bundle, as per Brew cask, and properly located is your best bet. Note that bundle can just be downloaded from S3, I recommend it over any other method, unless you're hacking the C source. Which would legitimise building from scratch.
|
I wonder if maybe it would be worth changing |
Copy apps would be ok, but move apps would be better. The problem then is dealing with the headache of shifting the entire homebrew user base. Ugh! ;)
|
Then remove the app bundle from the formula. Either it's in there and should be supported and work correctly or it's not.
There is a reason, however, to not want to manually copy or link the app bundle in order to automatically keep it up-to-date when brew updates it. Having to watch for emacs to get updated among all installed packages and then manually moving it into place is tedious.
Again, if this is the case, the emacs formula should be fixed to move the bundle or, if this is not possible, the app bundle target should be removed. It seems people forget that Homebrew is not only for building packages and resolving deps, but also to install those packages (hence |
@jasonm23 looks like you've also deleted a similar message from Sep 15. It's still in everyone's inbox:
Relying on social contract so users don't use certain features of the formula doesn't scale. As I said previously, either remove the app bundling or fix the installation to work properly. All these users are not incorrect for expecting |
The problem is that bundles were not really an intended target. The automatic installation to /Applications/ violates Homebrew's aim/philosophy to avoid touching the standard OS X software locations. You can find this mentioned in many threads. Brew cask is the net result of this problem, however it doesn't fix this issue properly and uses symlinks. Which isn't a good solution for Spotlight. Simply following the correct convention in the first place would have avoided a lot of noise and issues. Unfortunately a U turn is as messy and unpleasant as the problem we want to fix, now that the culture of Brew Cask has taken root. The way to properly deal with your spotlight issues are to make /usr/local/Cellar or whatever indexed as a first class location for Spotlight, however as Yosemite and El Capitan illustrate, Apple will often take security measures at odds with this sort of customisation. Alternatively, as is my original suggestion, whichever app bundles you wish to install via brew/brew cask, move them to /Applications The "automatic upgrade" via Brew was never particularly satisfactory and a good sized group of Apps use Sparkle to upgrade themselves anyway. Of course this does not apply to Emacs Mac, but using the Brew Cask, app bundle move method is not beyond anyone capable of actually working with Emacs. |
Since touching the core filesystem breaks the homebrew philosophy this becomes a difficult issue. My feeling is the same as yours. It should be automated out of the users hands. App bundles are a case where the homebrew philosophy is broken (better to say incomplete!)
|
I'm closing this conversation as it's not really closing anywhere. To summarise:
Thanks! |
After building Emacs via 'brew install emacs --cocoa', the resulting Emacs.app is in
/usr/local
. This makes it unfindable via Spotlight, as Spotlight (supposedly) deliberately skips/usr/local
during indexing. Linking to the built Emacs.app from/Applications
also doesn't work for some reason. Given homebrew doesn't like .apps anyway, would it be possible to have brew install the resulting .app into /Applications?The text was updated successfully, but these errors were encountered: