1

I have a weird problem. When I launch emacs GUI by double clicking the icon, or using open -a emacs in the terminal, or calling the application from alfred/spotlight it takes 4-8 seconds to launch. But when I launch GUI emacs from the terminal by calling /Applications/Emacs.app/Contents/MacOS/emacs it starts in about 1 second or a bit less. I haven't noticed this discrepancy before and I think it must be related to the way I'm building emacs but I can't see how.

So why would emacs start more quickly when calling /Applications/Emacs.app/Contents/MacOS/emacs than it does when calling /Applications/Emacs.app?

I'm running emacs 27.0.5, but the same problem occurs with emacs 26.2.

I'm on macOS running Mojave 10.14.5. The build config is:

./autogen.sh
./configure \
    --build=x86_64-apple-darwin \
    --without-dbus \
    --with-ns \
    --with-imagemagick \
    --with-modules \
    --with-gnutls \
    --with-json \
    --disable-silent-rules \ 

make
make install
mv nextstep/Emacs.app /Applications 
mclear
  • 1,525
  • 9
  • 17
  • This sounds like a MacOS problem to me: maybe something in the layers between clicking the button and running the program has slowed down. Once running, does emacs behave "normally"? Disclaimer: I know nothing about MacOS. – NickD Jul 19 '19 at 14:58
  • Yeah - it could definitely be a macOS issue. But I don’t have any idea of why the application bundle would be slower to launch than the executable all of a sudden. Especially since i don’t think I’ve made any system updates recently. – mclear Jul 19 '19 at 15:15
  • I keep a copy of Emacs from https://emacsformacosx.com/ for troubleshooting, but do not use it for my daily workflow. E.g., whenever I want to know how Emacs behaves without any user configuration, I break out the above-mentioned copy to do my testing. I would suggest downloading a copy and trying it to see if something in your build is at issue, or whether it affects other builds of Emacs too. If the same problem is present with the build mentioned in this comment, then it is probably time to `M-x report-emacs-bug`. – lawlist Jul 20 '19 at 15:26
  • Thanks @lawlist -- that was a good idea. the standard build of 26.2 from emacsformacosx doesn't show the delay. I've compared this with my builds of 26.2, 26.2.9, and 27, which all are slow to start when the app bundle rather than the exec is called, so it must be something fishy with my build. If you have any ideas as to how to track down that problem they'd be much appreciated! – mclear Jul 20 '19 at 17:19
  • The next step might be to build a stripped down version of Emacs and see if the problem is present with that barebones installation. If the problem is not present with a barebones installation, then begin adding stuff one by one and build, test, repeat, ... When building Emacs, it will automatically install stuff available in your `$PATH` -- e.g., certain image support, makeinfo, etc. Thus, it may be necessary to explicitly exclude certain components in the `./config ...` command line. After the `./config` is finished, look at the options Emacs intends to install as a helpful guide. – lawlist Jul 20 '19 at 18:00
  • I have a related weird problem. I also build my own emacs, and opening a link when running `/Applications/Emacs.app/Contents/MacOS/emacs` is fast, but opening a link when running `/Applications/Emacs.app` (either from alfred/spotlight or with the `open` command line tool) is slow, taking 5+ seconds. But on my system startup is fast both ways. So I wonder if something your startup file does is similar to my emacs opening a link. – amitp Oct 15 '19 at 22:41
  • @amitp that could definitely be related. Unfortunately I haven't been able to figure out what the issue is for my builds. I've reverted to using [emacs-head](https://github.com/daviderestivo/homebrew-emacs-head). – mclear Oct 16 '19 at 15:04

0 Answers0