Fix Line Endings Between Various File Systems

Submitted by Peter Majmesku on Mon, 08/29/2016 - 19:56

If you work sometimes on Windows, sometimes on Mac and sometimes on Linux, you can get troubles with line endings. Programs which aren't smart enough to detect line endings by them self, will display the text as if the file contained no line breaks at all.

  • Windows, and DOS before uses a pair of CR and LF characters to terminate lines
  • UNIX (Including Linux and FreeBSD) uses an LF character only. 
  • OS X also uses a single LF character 
  • Classic Mac operating system used a single CR character for line breaks. 

That's tricky. A tool for fixing line endings is "SFK - The Swiss File Knife File Tree Processor". It's mentioned at http://stackoverflow.com/questions/7068179/convert-line-endlings-for-whole-directory-tree-git/16886243#16886243.

All you have is to use the following command for converting to Mac OSX:

sfk remcr -dir your_project_directory