I'm using screen /dev/tty.usbmodemxxxx to debug a physical device. An unavoidable part of my workflow disconnects and reconnects the device, causing screen to terminate; so I need to start it it up again.

Is there a way for me to say "keep screen alive listening on /dev/tty.usbmodemxxxx - just hang while it's not connected"?

  • Doesn't screen -r -d <screen name> work to reattach the screen ?
    – amisax
    Jul 7, 2015 at 12:58
  • @AmitKumar "bad session name"
    – OJFord
    Jul 7, 2015 at 14:00
  • How do you start the screen ? What do you see in "screen -ls"
    – amisax
    Jul 8, 2015 at 5:57
  • @AmitKumar Starting with screen /dev/tty.usbmodem as I said in OP.
    – OJFord
    Jul 8, 2015 at 20:41

1 Answer 1


Just a hack but you could write a wrapper script like:

while [ TRUE ]
screen /dev/tty.usbmodemxxxx
read -p "connect again?"

and CTRL-c it when you want to stop.

You must log in to answer this question.

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