Is there a way to quickly pretty print large XML files without needing an app? Online solutions don't allow for massive files and I'd like to do this without install more junk on my computer.

1 Answer 1


Macs come with libxml2 which inclues a tool called xmllint. You can use this to format your xml with ease. The tool does not have a graphical interface, so you'll need to fire up terminal.

Example 1. Format a file

xmllint --format - < file_to_format.xml > formatted_output.xml

Example 2. Format xml from clipboard

pbpaste | xmllint --format - > formatted_output.xml
  • 1
    The link to the blog is no longer valid. The rest of this answer is correct and useful.
    – sonofagun
    Jan 26, 2020 at 18:26
  • 1
    Very helpful, in deed. And after 7 years, I assume no other answer will come in, and you could consider accepting your own answer ;-) ... thank you very much!
    – GhostCat
    Mar 26, 2020 at 11:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .