Running Marked 2 from the Command Line

August 14, 2014

Marked 2 has been out for a while now and it was even recently added to the Mac App store. After upgrading, I immediately noticed that the old command line tool, mark, can no longer installed because the app is now sandboxed. The previous version of Marked would allow one to enable the command line interface via a menu item called “Install Command Line Utility”. As such, I had an old symbolic link in /usr/local/bin/ pointing to the old script that lived within the bundle. Since that script no longer exists, the following can act as simple drop-in replacement:

if [ $1 ]; then
    open -a "Marked 2" $1;
    open -a "Marked 2";

Removing the old symbolic link (if you have it) and installing this script in it’s place will allow any pre-configured applications to continue using Marked to open Markdown files. For example, I have the following in my .emacs file as part of my Emacs Markdown mode configuration.

(setq markdown-open-command "/usr/local/bin/mark")

With the above script, I can continue to open Markdown files in Marked from within Emacs using C-c C-c o.