12

After upgrading to macOS Catalina, Emacs (v26.3 from GNU Emacs for Mac OS X) works very strange. Without Emacs already running, Finder can open a file with Emacs as usual. But once Emacs.app is running, it cannot any longer. For example, double clicking the file on Finder window does nothing; no error message, either.

Opening a file from Emacs GUI causes no problem. Drag-ang-drop'ing a file onto Emacs also works fine.

Masso Chailly
  • 123
  • 1
  • 4
  • I suggest you take a look (within Emacs) at C-h l after such "failed" operations to see if Emacs received some event at all. If not, the problem likely can't be solved on Emacs's side and you should post your question elsewhere. – Stefan Oct 20 '19 at 14:11
  • You're right. Looks like Emacs doesn't get any event call. But, is it not Emacs issue? I thought it's a matter of building Emacs. (By the way, I installed Emacs with Homebrew). Where would it suit better? Homebrew? – Masso Chailly Oct 21 '19 at 04:04
  • sorry, but my outlook on this is along the lines of "why don't you upgrade to GNU/Linux?", which probably won't help you very much. You can file a bug report with M-x report-emacs-bug. – Stefan Oct 21 '19 at 13:06
  • I see. Thanks for your remarks and suggestions anyhow. – Masso Chailly Oct 22 '19 at 06:22
  • I thought this answer would be responsive, but I tried the steps and it didn't work. – HaPsantran Nov 25 '19 at 16:07

4 Answers4

12

If your Emacs is downloaded from https://emacsformacosx.com/, Emacs.app launches a binary Emacs.app/Contents/MacOS/Emacs-x86_64-10_14 via a ruby script Emacs.app/Contents/MacOS/Emacs. Modify Emacs.app to launch a binary directly with the following in terminal.

cd /Applications/Emacs.app/Contents/MacOS
mv Emacs Emacs-orig
ln -s Emacs-x86_64-10_9 Emacs
rm bin
ln -s bin-x86_64-10_9 bin
rm libexec
ln -s libexec-x86_64-10_9 libexec

Edit by Masso: Emacs-x86_64-10_14 breaks forward search (from Emacs to Skim) on macOS 10.15 (Catalina). So I have changed the version numbers above to 10_9 (instead of 10_14 that was originally suggested by Akira). Edit by acr: the rm'd directory should be libexec.

NOTE: For macOS Catalina 10.15.7 Emacs 27.1 (9) I needed to use _14. My install was already linked to _10 and having the permission problem. I made these changes after updating Security & Privacy settings giving Full Disk Access to Emacs.app. I installed emacs via brew and noticed the problem after recently upgrading on 12/20/20. The older version didn't have the problem AFAIK and I had previously applied the fix detailed here. I'm not using Emacs Skim and not familiar with the problems mentioned by Masso and I want the latest Emacs version. Setting to _14 worked for me:

% cd /Applications/Emacs.app/Contents/MacOS
% mv Emacs Emacs-orig
% ln -s Emacs-x86_64-10_14 Emacs

% rm bin % ln -s bin-x86_64-10_14 bin

% rm libexec % ln -s libexec-x86_64-10_14 libexec

  • I wanted to add a comment for Akira Kitauchi, but I don't have enough (50) reputations to do it. Hence I put it here. Akira's solution is interesting and does work for me. However, the so-called "forward search" from Emacs (working with a LaTeX file) to Skim (v1.5.5) breaks down. Backward search from Skim to Emacs works fine. Any idea? Edit: Even more interesting! I switched symbolic links to x86_64_10_9 versions (rather than x86_64_10_14 versions as Akira originally suggested). Then both forward and backward search work well. Curiously, what are the differences between the different version
  • – Masso Chailly Dec 18 '19 at 08:11
  • @MassoChailly The different versions are built for different versions of macOS, so if you're on macOS 10.14 (Mojave) or above then you want to use the _10_14 one. macOS 10.9 to 10.13 then _10_9, and so on. Although, to be honest, I wouldn't expect search to break. – Alan Third Jan 22 '20 at 19:58
  • 1
    Hm...this "worked" for me, in the sense that everything behaves as expected using the Catalina "open" command (or the finder). However, now using emacs from inside a terminal window seems broken. – acr Feb 14 '20 at 22:35
  • 1
    I also had to use a lower ending number, *_10 in my case, instead of a higher *_14 to get things to work, even when I was on Catalina – Paul Sep 02 '20 at 01:10
  • There's an open issue for this on the github project for this emacs distribution https://github.com/caldwell/build-emacs/issues/91 – Doug Harris Dec 02 '20 at 19:00
  • While this works well for me (as does the answer from @HaPsantran), it does seem to break the call to emacs (/usr/local/bin/emacs -> /Applications/Emacs.app/Contents/MacOS/Emacs), which fails with warnings/errors that boil down to a directory /Users/build/workspace/Emacs-Multi-Build/label/macos10.11/emacs-source/nextstep/Emacs.app/ not existing. Note directly calling /Applications/Emacs.app/Contents/MacOS/Emacs does work. Any thoughts? – lab Jun 16 '21 at 10:37
  • 1
    Thanks! This happily seems to work for me in macOS Monterey 12.2.1, too. Like @lab, I ran into the command-line emacs issue, and resolved it by replacing my emacs symlink with a small shell script that just invokes /Applications/Emacs.app/Contents/MacOS/Emacs -nw "$@" – ecmanaut Feb 23 '22 at 23:42
  • I also ended up using the same workaround that @ecmanaut suggests, with a little shell script named emacs that calls /Applications/Emacs.app/Contents/MacOS/Emacs "$@". – lab Feb 24 '22 at 10:27