Multiple Emacs instances in OSX

March 18, 2011

Here is a very simple tip that has been really useful to me over the last few months.

The way I work in Emacs is by opening lots and lots of files and then quickly selecting the buffer I want with ido-mode.

However, this breaks down if I have more than one project loaded in my Emacs session. For example, when working on Rails projects, I want to be able to find the routes.rb file with just a few keystrokes. To avoid restarting Emacs whenever I switch project, I need multiple instances running simultaneously, which is not “supported” in OSX (or rather, it’s just not the OSX way).

To workaround this, I use a really simple hack: Copying Emacs

So to create Emacs2 and Emacs3 in addition to just Emacs, do

cp -r /Applications/ /Applications/
cp -r /Applications/ /Applications/

That’s it! Now you can fire up three Emacs instances at the same time. Next step will be to replace the icons of the clones to make it easier to spot them when switching applications.


As discussed in the comments below, I can just start new instances with “open -n -a”. Thanks tali713 for bringing this to my attention!

4 Responses to “Multiple Emacs instances in OSX”

  1. chopmo Says:

    I am, but especially in Rails projects, this breaks down pretty quickly.

    Say I want to find the file index.html.haml. It could be in any of lots of view folders, and uniquify is nice for identifying the right one. But if I mix several projects, it would become pretty painful for me to pick the right view folder.

    Thanks for the suggestion though.

  2. tali713 Says:

    What’s wrong with the standard command from terminal: “open -a -n ” you could even write a short applescript program to automate the task. Simple, built in, no wasted duplications.

    • chopmo Says:

      Brilliant! Nothing is wrong with using open, I just hadn’t noticed the “-n” switch, so thanks for pointing that out :-)

      As you suggest, I can use Applescript to automate this. In fact, it’s a one-liner in AppleScript editor:

      do shell script “open -n -a”

      After saving this script as /Applications/, I can easily launch new Emacs instances from Spotlight.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: