diff -uNr imap-2006i/src/osdep/unix/env_unix.c imap-2006i-osx/src/osdep/unix/env_unix.c
--- imap-2006i/src/osdep/unix/env_unix.c	2007-05-29 22:29:52.000000000 +0200
+++ imap-2006i-osx/src/osdep/unix/env_unix.c	2008-08-07 12:30:57.000000000 +0200
@@ -1185,8 +1185,9 @@
 	    for (cf = max (20,max (max (pi[0],pi[1]),max(po[0],po[1])));
 		 cf >= 3; --cf) if (cf != fd) close (cf);
 				/* be our own process group */
-	    setpgrp (0,getpid ());
-				/* now run it */
+	    //setpgrp (0,getpid ());
+		setsid();	
+			/* now run it */
 	    _exit (execv (argv[0],argv));
 	  }
 	  _exit (1);		/* child is done */
diff -uNr imap-2006i/src/osdep/unix/tcp_unix.c imap-2006i-osx/src/osdep/unix/tcp_unix.c
--- imap-2006i/src/osdep/unix/tcp_unix.c	2007-02-01 06:21:37.000000000 +0100
+++ imap-2006i-osx/src/osdep/unix/tcp_unix.c	2008-08-07 12:31:39.000000000 +0200
@@ -405,8 +405,9 @@
       dup2 (pipeo[0],0);	/* parent's output is my input */
 				/* close all unnecessary descriptors */
       for (cf = 3; cf <= maxfd; cf++) close (cf);
-      setpgrp (0,getpid ());	/* be our own process group */
-      _exit (execv (path,argv));/* now run it */
+      //setpgrp (0,getpid ());	/* be our own process group */
+      setsid();
+	_exit (execv (path,argv));/* now run it */
     }
     _exit (1);			/* child is done */
   }

