Open .md files by default on a Mac
Double-clicking a markdown file opens a text editor full of raw symbols, or something that offers to import it into a library you did not ask for. One minute in Finder fixes it for good, and no app can do it for you.
The one minute
- 1Select any .md file in Finder.
- 2Press Command-I, or right-click and choose Get Info.
- 3Open the Open with section.
- 4Choose the app you want from the list.
- 5Press Change All, and confirm.
Change All is the step people miss. Without it you have opened one file once; with it, every .md file on the machine goes to that app from now on. The same route works for .markdown, .mdx and .txt, and you have to do each extension separately, because macOS treats them as different types.
Why no app can offer to do this for you
Every markdown app for the Mac makes you do this by hand, and it is fair to wonder why not one of them has a “make me the default” button when that is obviously what everybody wants.
The API exists. NSWorkspace.setDefaultApplication(at:toOpen:)is right there and it compiles. What happens is that the App Sandbox refuses it at runtime, with an error that means the operation is not permitted, and Apple’s own developer support has confirmed on the forums that this is intended rather than a bug.
So it is not a missing feature and it is not laziness. Any app you install from the App Store runs in that sandbox, which means switching to a different markdown app will not get you the button either. An app distributed outside the App Store can do it, and that is the real trade: the button, or the review process and the sandbox that come with the store.
While you are in there
If you also want the space bar to preview a markdown file properly in Finder, that is a separate switch and it is off by default. Open System Settings, then General, then Login Items and Extensions, find Quick Look, and turn the app on. macOS switches new extensions off without telling you, which is why a fresh install often previews nothing.
On a Mac, this should not need a browser
Double-clicking a .md file opens a text editor full of raw symbols, and the space bar in Finder shows you the same. The Mac app fixes both: it registers as the handler for markdown and adds a Quick Look extension, so the rendered document is one space bar away.
For Mac.