Set RS232 port options from MacOS X CLI
To read from my arduino or attiny, I use this simple program:

#include &lt;unistd.h&gt;
#include &lt;fcntl.h&gt;
#include &lt;termios.h&gt;

int main(int argc, char **argv) {

    int fd;
    ssize_t len;
    unsigned char buf[8192];
    struct termios tio;

    fd = open( argv[1], O_RDONLY | O_NOCTTY | O_NONBLOCK );
    cfmakeraw(&amp;tio);
    cfsetispeed(&amp;tio,B9600);
    cfsetospeed(&amp;tio,B9600);
    tcsetattr(fd,TCSANOW,&amp;tio);

    for(;;) {
        len = read( fd, &amp;buf[0], 8192 );
        if( len &gt; 0 ) write(1,buf,len);
        sleep(1);
    }

}


On the mac, using the FTDI chip (Arduino Duemilanove) for serial means that the stty command has no lasting effect.  Once the port is closed, it reverts to default parameters.  While this program is running, you can use stty to alter parameters.

Here is the default:

$ stty -f /dev/tty.usbserial-* -a
speed 9600 baud;
lflags: -icanon -isig -iexten -echo
iflags: -icrnl -ixon -ixany -imaxbel -brkint
oflags: -opost -onlcr -oxtabs
cflags: cs8 -parenb


Then if the C program is running:

$ stty -f /dev/tty.usbserial-A6003SHf -a
speed 9600 baud;
lflags: -icanon -isig -iexten -echo
iflags: -icrnl -ixon -ixany -imaxbel ignbrk -brkint
oflags: -opost -onlcr -oxtabs
cflags: cs8 -parenb -hupcl
discard dsusp   eof     eol     eol2    erase   intr    kill    lnext   
^@      ^@      ^@      ^@      ^@      ^@      ^@      ^@      ^@      
quit    reprint start   status  stop    susp    werase  
^@      ^@      ^@      ^@      ^@      ^@      ^@      


You can change the baud rate if for instance the Arduino is using Serial.begin(19200) for faster transmission.

$ stty -f /dev/tty.usbserial-* 19200
$ stty -f /dev/tty.usbserial-*
speed 19200 baud;
lflags: -icanon -isig -iexten -echo
iflags: -icrnl -ixon -ixany -imaxbel ignbrk -brkint
oflags: -opost -onlcr -oxtabs
cflags: cs8 -parenb -hupcl
discard dsusp   eof     eol     eol2    erase   intr    kill    lnext   
^@      ^@      ^@      ^@      ^@      ^@      ^@      ^@      ^@      
quit    reprint start   status  stop    susp    werase  
^@      ^@      ^@      ^@      ^@      ^@      ^@      


Once the C program is closed, the serial port reverts back to its default.