Inexperienced programmer here - When I open Emacs (24.5) on Mac Mavericks 10.9, I am getting a delay between the Emacs GUI opening and the init file being loaded. There is a white screen, which appears to do nothing for ~7 seconds.

Could this be a result of something in my init file (which otherwise loads without error), or must it originate from something in my PATH or .bash_profile?

I have an alias set to open emacs from the Terminal:

alias="open /Path/To/Emacs-x86_64-10_9"

Any other ideas what this might be our how I can debug the pause?


Here is the output of etc/hosts, @phils having pointed out it may be the cause.

# Host Database
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
#      localhost broadcasthost
::1             localhost
fe80::1%lo0     localhost
  • If it's your init file, you can test that by starting Emacs with emacs -q to prevent it from processing that file. Otherwise, is this the problem? – phils Jan 4 '16 at 8:43
  • @phils - I can't say I completely understand that post - I have updated my OP with the contents of the /etc/hosts file, hoping it means something to you and others. – n1k31t4 Jan 4 '16 at 8:55
  • @DexterMorgan as for starting emacs with the -q option: open your terminal app (Terminal.app) and enter emacs -q at the prompt. Does this make things load quickly? – elethan Jan 4 '16 at 12:55
  • @elethan - I actually get the message saying the -q flag is invalid. I have done this before though so it must be something to do with the alias I mentioned, or possibly a problem with my $PATH? Even opening a file using open file.txt -a /path_to_emacs -q is returning the same error. – n1k31t4 Jan 4 '16 at 13:16
  • 1
    An upper-case -Q combines a few other options, but lower-case -q is equivalent to --no-init-file and doesn't prevent any other start-up activities, so this does look like an init file issue. See C-h i g (emacs) Initial Options for details on the available command-line options. – phils Jan 4 '16 at 20:02

A bit of added information for your init file processing time:

Put this at the very start of your init file:

(defvar my-init-load-start (current-time))

and this at the very end:

;; Display the time taken to start Emacs.
(let ((my-init-time (time-to-seconds (time-since my-init-load-start))))
  (add-hook 'after-init-hook
            `(lambda ()
               (message "Init time was %.2fs (%.2fs in %s)."
                        (time-to-seconds (time-since before-init-time))
                        (file-name-nondirectory user-init-file)))))

After starting Emacs, look for that timing message in the echo area, or else switch to the *Messages* buffer with C-he to find it in the log.

| improve this answer | |
  • Thanks - this is useful to track the (side-) effects of additions to an init file. – n1k31t4 Jan 8 '16 at 8:29
  • My start-up time in Emacs is 3.3 seconds now without the long pause occurring. – n1k31t4 Jan 8 '16 at 8:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.