Retrieving files from Sd card with Serial port?

I have a project that I want to put into a case, which will allow the USB connection but not (easily) SD card removal. I use SdFat for logging. Is there a function or sketch that would send a file from the card over Serial to the programming computer? Thanks for any help.

Is there a function that would send a file from the card over Serial to the programming computer? Thanks for any help.

file.read() and Serial.print() in a while loop.

Sorry; I wasn't clear. I want to save it on the computer's (Mac) hard drive, just as it exists on the card. Is there a way to pipe it to a file on the Mac?

The Arduino doesn't have any access to the host machine's filesystem. You'll have to write code on the Mac to send the serial output to a file.

There is an old unix tool called "cu" (for "callup") which you can use to talk to the serial port. It has a man page. You probably want something like

cu -l /dev/cu.usbserial-whatever -s 9600 > outputfile

Beware that cu does strange things to the terminal's stty settings, so piping to another process doesn't work like you might expect.