Serial monitor does not show data from USB (Mac)

In Arduino 1.8.5 and a iMac with OS X 10.11.6, Serial monitor does not show any data out of the DUE Native USB port.

I am using working code flashed from a different Mac (it is working, I don't want to risk a broken download), and I know the code and USB port are working (I can use unix commands to elicit responses and capture output out of the DUE). I've tried with and without an intervening USB hub.

Among my many tries during a couple of days it worked only once, briefly, and then stopped working during that same session.

I don't see any forum topic with this specific problem, all of them deal with either Mac USB port problems, Arduino code problems, or USB cables. But not specifically with serial monitor refusing to work when everything around it seems to be fully functional.

Does the baud rate selection in the bottom right corner of Serial Monitor match the number passed to Serial.begin() in your sketch?

The baud rate is irrelevant when using the native USB port in a DUE. It is ignored by the function call (and Serial Monitor). But yes, I made them match just in case.

I noticed that the code was not waiting for USB to be ready. So I added

while(!SerialUSB){
    digitalWrite(PIN_LED, HIGH);
    delay(125);
    digitalWrite(PIN_LED, LOW);
    delay(125);
}

After this change the DUE waits for the terminal to be opened and the terminals display the initialization text without a hitch. After that the behavior is the same as reported before.

Note that I am able to program the DUE through that same port, and that the Matlab-based application communicates with the DUE just as designed. The problem is only with SerialMonitor (or the unix screen command)

I found the problem.

I was certain that I had already checked this before posting. As a matter of fact, I am sure that it is the first thing I checked, something else must have changed in the interim.

The code was expecting a newline character before it sent anything back while the terminals were just sending a carriage return.