← Back to blog

Article

Remove Control-M symbols from files on Mac

Before

$ vi -v file
This is a test^M

Remove Control-M symbols from files on Mac

  1. Using sed command
find . -type f -exec sed -i '' -e 's/\r//g' {} \;
  1. Using dos2unix command
brew install dos2unix
find . -type f -print0 | xargs -0 dos2unix

After

$ vi -v file
This is a test

Discussion

Profile picture

Full-Stack Engineer

Yerin Hong

Building products end-to-end across frontend, mobile, backend, and product UX.

Full-stack engineer and generalist. I design, build, and debug products with a bias for clean UX and practical engineering.

© 2026 Yerin Hong

Built with Gatsby