Why .md files open in Xcode or TextEdit, and how to fix it

You double-clicked a .md file and Xcode started loading. Or TextEdit, full of symbols. Or an app you forgot you had. Your Mac is following an old instruction, and you can change it in under a minute.

The short answer

A .md file opens in whichever app your Mac has picked for that file type. That's often Xcode after you install it, or TextEdit on a fresh Mac. To change it for every .md file, select one in Finder, press ⌘I, choose a Markdown reader under Open with, then click Change All and Continue.

Why did my .md file open in Xcode?

A .md file opens in Xcode because Xcode told your Mac it can open .md files, and your Mac took it at its word.

Every app carries a list of the file types it can open. Apple's developer docs describe apps that "declare themselves as editors or viewers" of a file type, each with a ranking (Apple developer docs). When several apps claim .md, your Mac has to pick one. Install a big app like Xcode and it can become the pick.

That's why the app seems random. It depends on what you've installed.

  • TextEdit is what a fresh Mac usually uses. It shows the raw # and ** symbols.
  • Xcode is Apple's tool for building apps. It's a large developer app, and it shows the raw symbols too.
  • Something odd, like a mind-mapping app or a terminal app, means that app claimed .md when you installed it.

Nothing is wrong with the file. It's just going to the wrong app.

How do I change which app opens .md files?

To change which app opens .md files on a Mac, use Get Info once and click Change All, and every .md file follows. These are Apple's steps (Apple Support):

  1. Click once on any file ending in .md in Finder. Don't open it.
  2. Press ⌘I, or choose File › Get Info.
  3. Click the arrow next to Open with to show that section.
  4. Open the pop-up menu and choose the app you want.
  5. Click Change All, then Continue when your Mac asks you to confirm.
  6. Close the Info window and double-click the file to check.

Step 5 is the one people miss. Choosing an app from the menu without clicking Change All only changes that one file.

Pick an app that formats Markdown, so you see headings and tables instead of symbols. If you don't have one yet, how to open a .md file on a Mac compares the free and paid options.

Is there a one-click way to set the default .md app?

Yes, if the Markdown app offers it. In One Clear Reader, click Make this my default .md reader on the welcome screen. It does the same job as Get Info and Change All, without the Info window.

How do I change the default app for .txt and .csv files?

You change the default app for .txt and .csv files on a Mac the same way, with Get Info and Change All. Each file ending has its own default, so repeat the steps with one file of each type.

  1. Select a .txt file, press ⌘I, choose an app under Open with, click Change All.
  2. Select a .csv file and do the same.

Plain text files usually open in TextEdit. CSV files usually open in a spreadsheet app such as Numbers or Excel, if you have one.

One Clear Reader has a shortcut for this too. Press ⌘K, search for Open .txt and .csv files in One Clear Reader, and choose it. It sets One Clear Reader as the default for .txt, .csv and .tsv files.

Know what you're switching to before you do:

  • .txt files open as plain paragraphs, with every symbol kept as typed. You can edit and save them.
  • .csv and .tsv files open as one sortable table. They are read-only, so you can look but not change cells.

If you edit spreadsheets often, keep Numbers or Excel as the default for .csv and open files in One Clear Reader only when you want a quick, readable look.

Why didn't Change All stick for my .md files?

When Change All doesn't stick for .md files, the cause is usually one of six things. This table matches each symptom to its likely cause and fix.

What you seeLikely causeFix
Only the file you picked opens in the new appYou chose the app but didn't click Change AllGet Info again, pick the app, click Change All, then Continue
.md files are fixed, but files ending in .markdown still open in XcodeYour Mac can treat .markdown as a separate typeRepeat the steps on a .markdown file
Your reader isn't in the Open with menuYour Mac hasn't offered it for this file type yetMake sure the app is in Applications and open it once, then try again. Or choose Other… at the bottom of the menu and pick it from Applications
It worked, then went back to Xcode laterAnother app that claims .md was installed or updatedDo the Get Info steps again
The right app opens, but you still see # and **The app you picked shows plain text, like TextEdit or XcodeChoose an app that formats Markdown
The file won't join the others, and its name looks oddIt's really called plan.md.txt, and Finder hides the last endingShow endings, then rename it to end in .md (see below)

That last one catches people who save files from TextEdit. TextEdit has a setting that adds ".txt" to plain text files when you save them (Apple Support), and Finder can hide endings. To see every ending, choose Finder › Settings, click Advanced, and turn on Show all filename extensions (Apple Support).

Good to know

Your Mac keeps one default per file type. Changing .md doesn't touch .txt, .csv or anything else.

How do I undo a default app change for .md files?

To undo a default app change for .md files, run the same Get Info steps with the old app. Select a .md file, press ⌘I, choose TextEdit (or whichever app you had before) under Open with, and click Change All.

This works the same whether you changed the default through Get Info or with One Clear Reader's button. Your files are never changed by any of this. Only the app that opens them changes.

Can I open one .md file in another app without changing the default?

Yes, you can open one .md file in another app without changing the default. Control-click the file, choose Open With, then pick an app (Apple Support). It opens there this once, and double-click keeps its usual app.

This is handy when you want to edit a file in one app and read it in another. Apple's own note on Change All says the same thing: "Don't click Change All if you only want the specific file you selected to open with that app."

How do I make .md files from AI tools open as pages?

To make .md files from AI tools open as formatted pages, set a Markdown reader as the default app for .md files. If your AI tools hand you .md files, you'll open a lot of them. Set the default once and every one opens as a formatted page, with real headings, tables and checklists.

One Clear Reader is free to read, search and edit Markdown, with no account. Click Make this my default .md reader on its welcome screen and you're done. If you'd rather keep a preview in Finder as well, see how to see .md files formatted in Quick Look. And if the symbols themselves are still a puzzle, what a .md file is explains each one.

Questions people ask

Does changing the default app change my files?

No. Changing the default app on a Mac only changes which app opens your files. The files stay exactly as they were, and you can switch back at any time.

Does Change All affect every kind of file?

No. Change All in Get Info changes files of the same type as the one you selected, such as every .md file. Your .txt, .csv and other files keep their own defaults.

Why does Xcode keep opening my Markdown files?

Xcode can open .md files, so your Mac may pick it, especially after Xcode is installed or updated. Select a .md file, press ⌘I, choose your reader under Open with, and click Change All.

Can One Clear Reader open .csv files for editing?

No. One Clear Reader shows .csv and .tsv files as a sortable table, but read-only. Keep Numbers or Excel as the default if you edit spreadsheets.

What do I need to run One Clear Reader?

One Clear Reader needs a Mac with macOS 13 or later. The current version runs on Apple silicon Macs only.

Keep reading

Stop reading code soup.
Free version forever. Every Pro feature free for 30 days. No card.
Download free for Mac