#0180: Making Emacs Appear in macOS Finder's Open With Menu for Markdown Files

How to fix the issue where Emacs doesn't appear in Finder's Open With menu for markdown files on macOS

Tags: braingasm, emacs, macos, finder, markdown, duti, symlinks, homebrew, launch-services, 2025

hero.png Source: DALLE-3 from OpenAI

4-out-of-5-hats.png [ED: Unless you’re an Emacs+macOS+markdown user, look away now!]

Braingasm

Making Emacs Appear in macOS Finder’s Open With Menu for Markdown Files

As a longtime user of Emacs (via Homebrew) on macOS, I have often encountered a frustrating issue: Emacs doesn’t appear in Finder’s “Open with“ menu for markdown files, despite being a capable markdown editor. This problem typically occurs when Emacs is installed (as instructed) as a symlink in /Applications/ (eg as Emacs.app@ -> /opt/homebrew/Cellar/emacs-mac@29/emacs-29.4-mac-10.1/Emacs.app).

The Problem

When you right-click a .md file in Finder and select “Open with“, Emacs may not appear in the list of available applications. This happens even when:

  • Emacs is properly installed in /Applications/
  • The application bundle declares markdown support in its Info.plist
  • Launch Services recognises the association

Why This Happens

The issue stems from macOS Launch Services not properly updating its database when applications are installed as symlinks. Finder relies on this database to populate the “Open with” menu, creating a disconnect between what the system knows and what it displays.

The Solution

After some hunting around I found out that the duti command line utility (see: brew info duti for details) can be used to explicitly set file associations:

# Install duti (if not present)
brew install duti

# Set Emacs as the default handler for markdown files
duti -s org.gnu.Emacs md all

Verification

Check that the association worked:

duti -x md

This command should return:

Emacs.app
/opt/homebrew/Cellar/emacs-mac@29/emacs-29.4-mac-10.1/Emacs.app
org.gnu.Emacs

Alternative Methods

If duti isn’t available, use Finder’s manual association:

  1. Right-click any .md file
  2. Select “Open with” → “Other…”
  3. Navigate to /Applications/Emacs.app
  4. Enable “Always Open With”
  5. Click “Open”

For persistent issues, rebuild the Launch Services database:

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

One note here: I found that the right-click approach didn’t work until I used duti, but after that, it started to work without issue. #ymmv

Some Technical Details

You can verify that Emacs declares markdown support by examining its Info.plist:

plutil -p /Applications/Emacs.app/Contents/Info.plist | grep -A 20 CFBundleDocumentTypes

The bundle should list “markdown” in the CFBundleTypeExtensions array.

The duti approach provides the most reliable solution, as it directly updates the file association database and immediately refreshes Finder’s available options. This method works regardless of how Emacs was installed and bypasses the symlink recognition issues that cause the original problem.

Regards,
M@


[ED: If you’d like to sign up for this content as an email, click here to join the mailing list.]

First published on matthewsinclair.com and cross-posted on Medium.

hello@matthewsinclair.com | matthewsinclair.com | bsky.app/@matthewsinclair.com | masto.ai/@matthewsinclair | medium.com/@matthewsinclair | xitter/@matthewsinclair

Stay up to date

Get notified when I publish something new.

Scan the QR-code to sign uo to matthewsinclair.com
Scan to sign up to matthewsinclair.com