So I have an Applescript to launch xemacs, but I thought it would be nice to have something I could drop files onto (and have an app to choose from contextual menus in the "open with" submenu), so I tried making an Automator app.

I called the app "XEmacs Opener.app" and it works... once. But it will not launch new XEmacs windows (unless I just click the run button from automator itself) until the first one is closed.

I tried running the shell script with nohup, used the '&' to put it in the background, and called exit afterwards, but this does not solve the problem:

nohup /sw/bin/xemacs "$@" &

Here's a screen-shot in case I didn't fully explain how it's set up:

enter image description here

I also tried calling xemacs without any arguments too. So how can I get this to open up multiple instances of xemacs - or is that not possible?

2 Answers 2


I figured it out. I just need to direct the output to /dev/null:

/sw/bin/xemacs "$@" &> /dev/null &

Easy peasy. The output was getting grabbed by the shell script. As soo as you redirect both standard out and standard error to /dev/null (i.e. oblivion), the rest of the workflow stops waiting and ends.


I was inspired by your question to tinker a bit. I don't have xemacs or use emacs, so I tried a text editor in terminal windows using iterm.

You can also use a second level of indirection in Automator I did this for joe (Joe's Own Editor).

top level Automator app

This calls a second app (Untitled.app) opening one file at a time allowing single quotes around the argument to joe, allowing spaces in path names for files (opened one at a time because of the first app):

subsidiary Untitled.app, passes spaces in path to single file

Dropping multiple files on the application at the same time gives:

three sessions open, one has spaces in path

The idea could be used with OS X's emacs for those used to tty sessions, noting this script doesn't deal with white space in path names as is.

You could also change the argument to the editor in Untitled.app, and drop files on Untitled.app directly:

COMMAND="cd '$PWD'; joe -mouse -wordwrap $1 $2 $3 $4 $5; exit"

And any null arguments won't get opened. Any excess files will fall on the floor based on finder order. You'll get all the files there are arguments for opened in the same terminal session:

opening multiple sessions in the same terminal window

And or course there are a couple of Cocoa bases emacs apps such as Emacs For Mac OS X, which from the date appears to be likely Yosemite compatible.

  • Cool. I assume you could do this with Terminal.app & vi as well. Nice.
    – hepcat72
    Nov 6, 2014 at 22:44
  • Should be able to do something analogous with Terminal.app. With focus on Terminal.app, Help -> Terminal Help, Help window Use automation and scripts -> Use AppleScript to automate tasks with Terminal. Also see the answers to Applescript to open terminal, run command, and show - Not working.
    – user90735
    Nov 7, 2014 at 0:11
  • Now I've just got to think of what to use it with... Wait, I have another thought. So I use a few java apps for bioinformatics research. I just double-click on their jar files to run them and then open the file using their horrible file browser. I wonder if there's a way to pass them the files on the command line... I'll have to think about this one.
    – hepcat72
    Nov 7, 2014 at 16:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .