Published on

How to get Emacs to Start Faster on Mac


I have been using spacemacs more and more lately. But one thing that bugged me is how long it takes to load initially which resulted in me switching to vim for anything I wanted to change quickly.

I have used spacemacs in the past and do remember I had some sort of alias to get it to start faster but I could not find what it was.

Today I dug a bit more and came across this answer which pointed me to this site.

Based on this I create a file called gnu.emacs.daemon.plist and put the following contents into it (taken from the second link):

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
     <plist version="1.0">
       <string>Gnu Emacs Daemon</string>

I then copied this file under: ~/Library/LaunchAgents/ and ran launchctl load -w ~/Library/LaunchAgents/gnu.emacs.daemon.plist. To confirm your emacs binary is in the same location run:

which emacs
# in my case this output `/usr/local/bin/emacs`
# Confirm where this symlinks to by running:
ls -al /usr/local/bin/emacs
# mine output: `/usr/local/bin/emacs -> /Applications/`
# In my case this is the same location as the service file above.

I also added an alias to my rc file to easily and quickly open emacs in a terminal: alias ec='emacsclient -nw -c'. Now to use this from a terminal I simply run: ec theFile and emacs opens super fast (thanks to the daemon that is running in the background).