detachtty is a Unix system programming utility that lets you run interactive programs (such as Lisp) non-interactively. Also, it allows you to connect to them over the network when you do need to interact with them. It's intended for use with long-running server processes running in Common Lisp implementations

If you've used screen, it's a similar concept, but more suited to traditional scrolling interfaces whereas screen is better for full-screen (e.g. curses-based) apps. Compared to screen, detachtty

  • has no capability to swap between different screens (doesn't eat C-a)
  • runs in line-at-a-time mode with no tty emulation (you can sanely use it in emacs comint modes or from inside a script(1) session)
  • has no features (less to go wrong)
  • and thus doesn't need a configuration file either

Example usage

server$ detachtty --dribble-file /var/log/cliki-dribble --log-file \
  /var/log/detachtty.log --pid-file /var/run/ \
  /var/run/cliki-socket /usr/bin/lisp -eval '(load-system :telentweb)' \
  -eval '(progn (telentweb::init) (telentweb::start))' \

client$ attachtty dan@server:/var/run/cliki-socket

to quit attachtty press ^\

Running via detachtty at startup

Start a script late .. i.e. S9xlispapp in rc[2|3].d/

start S9xlispapp

su - user -c /path/to/lisp-app-script
end S9xlispapp

start lisp-app-script


detachtty --dribble-file /var/log/lisp-app-dribble --log-file \
  /var/log/detachtty.log --pid-file /var/run/ \
  /var/run/lisp-app-socket /usr/bin/lisp -eval '(start-lisp-app)'
end lisp-app-script

-quasi (credit to Eduardo Muñoz for this information)

A more featureful init.d startup script for debian and compatible linuxes is introduced in

Actual usage

detachtty is running the SBCL instance that CLiki runs on


detachtty is mostly tested on Debian GNU/Linux, but contributed patches for FreeBSD and Solaris have been merged into it, so it's probably not too hard to get running on many Unices

apparently, it worked on macos at one time, but that is no longer true under macos 10.4 (tiger). It seems that tiger's poll does not work as advertised. it works on Tiger using ("OS_LOADLIBES=-lpoll -L/opt/local/lib" is the only change required to make it work on Intel, but I'm having some issues on PPC)


i386 Debian and source packages (currently at version 9) are at This package is also available in the main Debian repository. There's also a FreeBSD port, misc/detachtty, which you can get from the ports tree.

A new version, which includes the ablility to set timeouts and pass code to the detach'd lisp (for better scriptablity) is available in the darcs repo at:

Patches against that code would are more than welcome.


When I started my Lisp image at Systemstart I got always errors like:

c-string encoding error (:external-format :ASCII):
the character with code 195 cannot be encoded.

But it worked when I tried to start my Lisp image via the init.d script in the comandline.

The problem was solved when I added the following declarations to my init.d script:

export LC_CTYPE

See also: