Thursday, March 18, 2010

Serial Console on OSX

April 13, 2008 by Greg Ferro · 12 Comments 

This Post is Part of a Series — click for list on Console Mastery»

I bought a USB Serial port that had MAC drivers. Check before you buy it that it has drivers. Not all USB Serial have MAC sup­port. I assume that you have installed the cor­rect drivers from here.

First, open Terminal (Applications/​Utilities/​Terminal). Next, type

ls /dev/tty.*

to get a list of your serial lines. Pick the one that you want to open. For example, my list looks like this:

gf:dev gf$ ls -al tty.*
crw-rw-rw- 1 root wheel 18, 4 Jan 25 07:32 tty.Bluetooth-Modem
crw-rw-rw- 1 root wheel 18, 8 Jan 25 07:32 tty.Bluetooth-PDA-Sync
crw-rw-rw- 1 root wheel 18, 10 Jan 25 09:20 tty.PL2303-0000103D
crw-rw-rw- 1 root wheel 18, 0 Jan 25 07:32 tty.SerialPort-1
gf:dev gf$

And I know /dev/tty.PL2303-0000103D is the USB-​​to-​​serial adaptor becuase it’s con­nec­ted, if you unplug it the tty.PL2303-0000103D stops being listed.

Knowing the serial port, you can just type screen port­name datar­ate to show the serial data on the screen. In my case, it was:

screen /dev/tty.PL2303-0000103D 9600

To quit the screen app, type control-​​A, then control-\.

Postscript

I don’t think that this is very com­plete, but it worked for me and might help you to get your USB serial work­ing. Please let me know if there any­thing I can add to com­plete this piece.

Update 2008÷12÷28: A reader has poin­ted out this art­icle is based on a sim­ilar art­icle at http://​www​.tigoe​.net/​p​c​o​m​p​/​r​e​s​o​u​r​c​e​s​/​a​r​c​h​i​v​e​s​/​a​v​r​/​0​0​0749.shtml. I must have copied some of the text and then mis­takenly believed it was my own. Apologies for this mistake.

Please rate this post:

  Why Rate Posts?
1 Star - It\\\'s Crud2 Stars - It\\\'s Tosh3 Stars - Something\\\'s missing4 Stars - Needs works5 Stars - Good Enough6 Stars - Good7 Stars - Excellent8 Stars - Brilliant9 Stars - Astonishing10 Stars - Awesomely Godlike? (No Ratings Yet)
Loading ... Loading ...

Comments

12 Responses to “Serial Console on OSX”
  1. Brandon says:

    I bought the key­span serial adapter and it had a CD with MAC drivers. Installed it, plugged in the key­span to a switch and fired up Zterm. Zterm gave me a drop down of options on how to con­nect. Key was one of the options. I chose it and was con­nec­ted. I too stumbled around for a few days before i got it working.

    Brandon

  2. Greg Ferro says:

    I am sure that some people know how to do this, but for me, I had to work at it a little bit. There are some days when I just wish my first job was with *nix, my life would have been much simpler.

  3. John says:

    Note that the short form of “Macintosh” is not a TLA.

  4. Gary Smith says:

    The PL2303 chip­set based units are reas­on­ably well sup­por­ted under OSX since 10.4 now, and most USB serial leads are PL2303 based. There’s drivers avail­able from Prolific, the man­u­fac­tur­ers of the chip­set and also an open source avail­able through Sourceforge. However, there still seems to be an ongo­ing issue with send­ing breaks through the cable in that they get, er, broken. But oth­er­wise, if you’re look­ing for a cable then try to ensure it’s PL2303 based.

    Cheers,

    Gary Smith

  5. gok says:

    Using this, how could we send a break?, any key combination?

  6. cloudpunch says:

    Has any­one found a way to make this work on OS X 10.6.2 with unlim­ited (or at least increased) scroll­back? I’ve done moun­tains of research, but I’m no pro­gram­mer. If any­one has (or can fig­ure out) a usable applescript, I would extremely grateful!

  7. Doing “screen /dev/tty.PL2.…” gives me a screen with the serial cable con­nec­ted, which is great — but any idea how to get a second serial con­nec­tion up? It’d be quite nice to have a screen split and view­ing the out­put from two routers at the same time…

Trackbacks

Check out what others are saying about this post...
  1. […] tip: Serial Communication in OSX Terminal; Serial Com­mu­nic­a­tion in OSX Terminal; Openmoko USB serial with screen. Tagged with: mac leave a com­ment « Little […]

  2. […] this for my own use. I have blogged pre­vi­ously on using the Terminal to get a con­sole at Serial Console on OSX but this option uses a ded­ic­ated pro­gram which is easier to use. The most important […]



Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!