2 September 2010

Serial Console on OSX

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 support. I assume that you have installed the correct 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 connected, if you unplug it the tty.PL2303-0000103D stops being listed.

Knowing the serial port, you can just type screen portname datarate 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 complete, but it worked for me and might help you to get your USB serial working. Please let me know if there anything I can add to complete this piece.

Update 2008/12/28: A reader has pointed out this article is based on a similar article at http://www.tigoe.net/pcomp/resources/archives/avr/000749.shtml. I must have copied some of the text and then mistakenly believed it was my own. Apologies for this mistake.

Please rate this post:

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 ...

About Greg Ferro
Greg is a Network and Security Architect / Designer / Engineer working freelance in the UK and worked for Resellers, DotCom's, Large Corporate's and Service Providers across a variety of products & Vendors. He prefers to work for end users, believes in the life cycle, total cost of ownership and that near enough is often good enough. He likes talking about himself in the first person to feel "royal", even when hosting the Packet Pushers Podcast on Data Networking. More about Greg at http://etherealmind.com/who-am-i/ and you can follow him on Twitter.

Comments

  1. Brandon says:

    I bought the keyspan serial adapter and it had a CD with MAC drivers. Installed it, plugged in the keyspan to a switch and fired up Zterm. Zterm gave me a drop down of options on how to connect. Key was one of the options. I chose it and was connected. 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. Someone says:
    • Greg Ferro says:

      It would seem that I owe an apology as I must have taken at least some part of this article from http://www.tigoe.net/pcomp/resources/archives/avr/000749.shtml.

      If I try to remember I think I found a few references around the internet and had some notes that I had captured. I use a text editor and will cut/paste these notes. I must have forgotten or missed recording where I found those notes and when I later read the notes figured I must have written it – the author has the same tone as I do.

      I have made a note in main article referencing the original post. Thanks for pointing it out, it wasn’t deliberate.

  5. Gary Smith says:

    The PL2303 chipset based units are reasonably well supported under OSX since 10.4 now, and most USB serial leads are PL2303 based. There’s drivers available from Prolific, the manufacturers of the chipset and also an open source available through Sourceforge. However, there still seems to be an ongoing issue with sending breaks through the cable in that they get, er, broken. But otherwise, if you’re looking for a cable then try to ensure it’s PL2303 based.

    Cheers,

    Gary Smith

  6. gok says:

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

  7. cloudpunch says:

    Has anyone found a way to make this work on OS X 10.6.2 with unlimited (or at least increased) scrollback? I’ve done mountains of research, but I’m no programmer. If anyone has (or can figure out) a usable applescript, I would extremely grateful!

  8. Doing “screen /dev/tty.PL2….” gives me a screen with the serial cable connected, which is great – but any idea how to get a second serial connection up? It’d be quite nice to have a screen split and viewing the output from two routers at the same time…

Trackbacks

  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 comment « 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 import­ant [...]

Speak Your Mind

*