Well I just tried that code on my Mac and I don't get any errors.
However from the list it looks like your arduino is not the first one on it.
Try changing:-
myPort = new Serial(this, Serial.list()[0], 9600);
to
myPort = new Serial(this, Serial.list()[2], 9600);