Skip to content
Thomas Tempelmann edited this page Nov 26, 2019 · 4 revisions

Open a File in MacDown from Terminal

MacDown ships with a utility at MacDown.app/Contents/SharedSupport/bin/macdown. You can use this to launch MacDown straight from the Terminal. I use the following Bash function to access it:

macdown() {
    "$(mdfind kMDItemCFBundleIdentifier=com.uranusjr.macdown | head -n1)/Contents/SharedSupport/bin/macdown" $@
}

Note: You need to first launch MacDown at least once for this command to work. This registers com.uranusjr.macdown to OS X so that mdfind recognises MacDown by that identifier.

You don't need this Bash function if you install MacDown via Homebrew (which creates a soft link for you).

Open files with MacDown:

$ macdown file.md

will open file.md if it exists, or create a new document with that name if it does not.

You can also open more than one document this way:

$ macdown file.md another_file.md yet_another_file.md

Alternatively, you can use open -b com.uranusjr.macdown file.md or open -a MacDown file.md. Using the open command will not launch MacDown if the specified file does not exist, and therefore also won't create an empty document in this case.

Clone this wiki locally