References:

  1. http://www.xappsoftware.com/wordpress/2013/10/10/how-to-run-socat-on-mac-os-x/
  2. http://scott.cranton.com/2011/04/socat-is-so-cool.html
  3. http://justcheckingonall.wordpress.com/2009/06/09/howto-vsp-socat/
  4. http://buhadram.wordpress.com/2008/10/07/some-useful-socat-commands/

Install socat

sudo port install socat

Create a pair of VSP (Virtual Serial Port)

socat -d -d pty,raw,echo=0 pty,raw,echo=0
2014/08/07 01:40:56 socat[74896] N PTY is /dev/ttys001
2014/08/07 01:40:56 socat[74896] N PTY is /dev/ttys002
2014/08/07 01:40:56 socat[74896] N starting data transfer loop with FDs [3,3] and [5,5]

Open a new terminal and enter

sudo cat /dev/ttys001

Open another terminal and enter

sudo echo "Hello World" > /dev/ttys002

On the first terminal you will see the string “Hello World”.