- Yair Mark
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.
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" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>gnu.emacs.daemon</string> <key>ProgramArguments</key> <array> <string>/Applications/Emacs.app/Contents/MacOS/Emacs</string> <string>--daemon</string> </array> <key>RunAtLoad</key> <true/> <key>ServiceDescription</key> <string>Gnu Emacs Daemon</string> </dict> </plist>
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/Emacs.app/Contents/MacOS/Emacs` # 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).