Well, can’t tell you much without the broken g-code. My quick take is the file ends on the last line and there is no trailing CRLF.
Either it’s a Mac problem or you are hand coding something? What generated the file?