# LiveConsole 0.2.0, a window into your running program

**URL:** <https://www.ruby-forum.com/t/liveconsole-0-2-0-a-window-into-your-running-program/151380>\
**Category:** Ruby\
**Created:** [October 20, 2008, 8:55pm UTC](https://www.ruby-forum.com/t/liveconsole-0-2-0-a-window-into-your-running-program/151380 "2008-10-20T20:55:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pete\_E](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a9adbd/32.png) [@Pete\_E](https://www.ruby-forum.com/u/Pete_E)\
**Post date:** [October 20, 2008, 8:55pm UTC](https://www.ruby-forum.com/t/liveconsole-0-2-0-a-window-into-your-running-program/151380/1 "2008-10-20T20:55:30Z")

</div>

Hey, uh, here’s a long-overdue new release of LiveConsole. If you’ve  
never heard of it, it is a library for providing IRB over a TCP or Unix  
socket so that you can interact with a running application. It’s useful  
for debugging, for hot-patching code that you don’t want to interrupt,  
for interactive monitoring, and for looking cool. The new version is  
0.2.0, and contains a few API changes to accomodate the new capabilites:

- Unix Domain Socket support (Works under Linux and OS X,  
apparently; not likely to work under Windows)
- The ability to supply bindings to LiveConsole
- A program for interacting with the Unix socket (installed in  
your bin directory as udscat), as some versions of netcat  
don’t include this functionality.

There are two example programs in the doc directory, and a README. It  
should be pretty simple to operate, though, as there are only three  
methods (LiveConsole.new, LiveConsole#start, and LiveConsole#stop) that  
are important for most uses.

For the impatient:

# Run a LiveConsole with IRB bound to the toplevel:

lc = LiveConsole.new :socket, :port =\> 30303  
lc.start

# Note that we bind to localhost by default, so you can only

# connect to this from the same machine that is running it.

# Fire up a second terminal, and

you@your-box:~$ netcat localhost 30303  
irb(main):001:0\> puts “Hello, world!”  
=\> nil

# This shows up in the terminal of the program that created the

# LiveConsole:

Hello, world!

# Run a LiveConsole for the current process, and pass it the

# local binding (Unix only):

lc = LiveConsole.new :unix\_socket, :path =\> ‘/tmp/live-console.sock’,  
:bind =\> binding  
lc.start

# Fire up a second terminal, and

you@your-box:~$ udscat /tmp/live-console.sock  
irb(main):001:0\> local\_variables  
=\> [“\_”, “lc”]  
irb(main):002:0\> puts “Hello, world!”  
=\> nil

# Similar results, except that we’ve exposed the binding, so you

# can see local variables in caller, including the instance of

# lc. (Try re-starting it, just for fun.) See the example code

# or the README for details.

Installation:

gem install live\_console

For the non-impatient:

Have a look at [Debu.gs: LiveConsole](http://debu.gs/live-console) . There is also a  
Rubyforge site at [http://rubyforge.org/projects/live-console](http://rubyforge.org/projects/live-console) .
