Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I debug emacs' slow startup time?

I recently got a new Retina MacBook Pro, with Mountain Lion. Unfortunately, emacs is taking forever to startup (around 5s) on my new computer. I tried installing the latest homebrew version of emacs, but the problem persists. I don't have a .emacs file, so I'm clueless as to what could be causing the slow startup.

What tools do I have at my disposal to debug where emacs is spending its time during startup?

like image 517
Mike Avatar asked Sep 06 '12 21:09

Mike


3 Answers

It looks like you need to have a fully-qualified domain name for your computer's hostname (e.g., myretina.local); otherwise, Emacs will be slow to start.

You can verify your hostname via Terminal with

hostname

and you can set it with

sudo scutil --set HostName myretina.local
like image 111
jmdeldin Avatar answered Oct 24 '22 09:10

jmdeldin


For starters, run emacs -Q (which will start Emacs with no start-up files at all), and see whether that's still slow.

You may wish to read over the following, which explains all the various possible files which Emacs will look for by default:

C-hig (emacs) Init File RET

like image 38
phils Avatar answered Oct 24 '22 09:10

phils


Changing hostname didn't do anything for me. What worked wonders for me seems counter intuitive, but now my emacs starts instantly from terminal. This is what I did

alias emacs=/Applications/Emacs.app/Contents/MacOS/Emacs --debug-init

However, it still takes a few seconds, sometime even 15 seconds, to start from the graphical interface. Weird!

like image 31
path4 Avatar answered Oct 24 '22 08:10

path4