

- #CHANGE DEFAULT APP FOR MAC FILE TYPE HOW TO#
- #CHANGE DEFAULT APP FOR MAC FILE TYPE CODE#
- #CHANGE DEFAULT APP FOR MAC FILE TYPE DOWNLOAD#
Copy & paste the script below into a file, save it as set_default_apps.sh, make sure it’s executable ( chmod 755 set_default_apps.sh), & then run it when you feel like it.MacOS comes with default applications that enable you to do various activities automatically, such as open emails, browse and listen to audio files. Now let’s put everything together into a shell script that you can run anytime you need to. In order, I tell duti the bundle ID of the app, the extension of the files, & all means “all files with that extension”.

md) & the bundle ID of the app that I want to open that extension ( com.sublimetext.2), so let’s use duti to do it: duti -s com.sublimetext.2. Or this: $ osascript -e "id of app "Mailplane 3 ""Ĭom.mailplaneapp.Mailplane3 Change the default app This works for any app on your system, like this: $ osascript -e "id of app "Espresso "" OR I can use this one-line AppleScript: $ osascript -e "id of app "Sublime Text 2 "" If I knew that another file type foo already uses Sublime Text as its default, I could use duti -x foo & look at the third line of the results, as with Mou above. There are a couple of ways I could get this info. I want to change from Mou to Sublime Text, so I need Sublime Text’s bundle ID. The app’s bundle ID, a unique identifier for each program that normally is written in a reverse-domain-name style (like or ).Why do this? Just so I can verify the current default, & then verify that any changes I make took. Find out the current default for an extension This results in the duti executable going in /usr/local/bin/ & its man page getting placed into /usr/local/share/man/man1/.
#CHANGE DEFAULT APP FOR MAC FILE TYPE DOWNLOAD#
Download it, untar it, cd into the directory, & then do the classic three steps 4.
#CHANGE DEFAULT APP FOR MAC FILE TYPE CODE#
You can grab the source code at Sourceforge 3. The program that makes it easy to change default apps via the command line is a free, open source app named duti 2. Find out the current default for an extension.
#CHANGE DEFAULT APP FOR MAC FILE TYPE HOW TO#
Before you can jump in, though, you need to install a program & also know how to gather a few pieces of key information. After I fix that problem (using the command line, natch), I’d like to quickly re-set my default apps.

It’s been that way for years, & it works fine.īut I want to use the command line instead. md, choose Get Info (or just select the file & press Command-I), find the Open With section, select Sublime Text, press Change All, press Continue when asked if I’m sure, close the Info window, done. Most Mac users of even mid-level sophistication know the drill: right-click on any file ending in. So when I click on foo.md, I want it to open in Sublime Text instead of Mou.

For a while I wanted the very nice (& free for now!) app Mou to open those, but now I’ve switched to Sublime Text for my Markdown editing 1. I use Markdown a lot, so I’m constantly creating files that end in the. Changing default applications on a Mac using the command line & then a shell script
