Search code examples
macosbashosx-lionampersand

Ampersand behavior in Bash on Mac OS X Lion


I previously used bash on ubuntu 10.04 LTS as my default shell environment. Recently switched to Mac and can't seem to figure out why programs called with ampersand don't launch. I figure it is a startup script modification or environment variable, either bash var or having to do with X11 that I need to set in .profile, but I can't find any info on this.

I can open a new terminal window or tab from the menubar and say run emacs, but I'm used to being able to type:

emacs foo.txt & 

to launch emacs in it's own window. On Mac OSX Lion, I get back a stopped pid.

Alt. I gave the example with emacs, but then I tried out typing:

xterm &

and that spawns a new xterm window as expected. Is emacs (default) that comes loaded in OS X Lion configured without X support?


Solution

  • OS X Lion has no X installed so you can't open standard emacs in X mode. You want to start a background process, this fails because emacs can't connect to any x server and bash prints the message, that you background process was stopped.