21

How can I open a file with an application, other than the default, using a keyboard shortcut? I don’t want to change the default application for the filetype.

E.g. sometimes I want to open a .html file using an editor instead of a browser.

2
  • 1
    The closest I get is if I know the name of the app, I press Cmd Shift /, then start typing the name, and use the down arrow to select Open With > App Commented Nov 27, 2012 at 12:44
  • There is a direct and super easy solution to this. Check my answer.Please accept it as answer if it serves your need.
    – Safwan
    Commented Jun 28, 2017 at 8:10

7 Answers 7

19

The best solution for me:

  1. Select file you want to open
  2. Press ++/ (opens up the mighty Help search)
  3. Then start to type a name of app you want to open
  4. Use arrow keys to select right menu item
  5. Press Enter
  6. Done!

For example I want to open HTML-file with Sublime Text instead of Chrome. I navigate to this file, press shortcut, type in "su", press down-arrow and press enter!

enter image description here

2
  • I had to first navigate to the Finder's actual "File > Open With…" menu item, and allow the submenu to populate before this would work, but once I did that it works as described.
    – George C
    Commented Dec 29, 2020 at 19:54
  • A similar alternate approach to this solution: Ctrl + F2 will highlight the Apple menu, which you can then navigate with using the arrow keys to choose the desired item under "File > Open > Open With…", and typing letters allows you to jump to menu names faster.
    – George C
    Commented Dec 29, 2020 at 20:00
7

I'm afraid there's no such shortcut. You can, though, create your own.

To do so just:

  1. Go to System Preferences / Keyboard / Keyboard Shortcuts / Applications.
  2. Click the + button.
  3. Choose Finder, from the drop-down list.
  4. On the menu title field add the exact name of the menu bar item. It this case it should be Other... instead of Open with.
  5. Pick your keyboard shortcut and click Add.

You'll be able to test the shortcut right away. Just mind the Open always with option!

10
  • I dont think this works. I just tried and looks like Finder confuses Open With and Always Open With (10.7.5): The keyboard shortcut pref and the error message
    – Nivas
    Commented Nov 27, 2012 at 12:37
  • 1
    @Nivas And here the preferences panel, in case I didn't make myself clear enough.
    – Thecafremo
    Commented Nov 27, 2012 at 13:02
  • 1
    Ah... I did not know that. Other... does work. (It does amaze the programmer in me though that there is an implicit assumption that the menu items should have unique names. What if another submenu has an Other? But that is beyond this question...)
    – Nivas
    Commented Nov 27, 2012 at 13:07
  • 1
    This is not working on 10.10 the menu Othe… get the shortcut but does not respond
    – markhunte
    Commented Dec 9, 2014 at 10:29
  • 1
    IT WORKS!! YAY!!! On macos 10.12 (sierra) at least
    – chrismarx
    Commented Aug 1, 2017 at 18:53
5

If you frequently open a file in a specific app (other than the default app), you can set a keyboard shortcut for doing it. This is super easy.

Let's say you want to open a file in Sublime Text whenever you press control+S after selecting the file.

  1. Go to System Preferences > Keyboard > Shortcuts (tab) > App Shortcuts (option in left sidebar).
  2. Create new shorctut by clicking/tapping on +.
  3. Select Finder as Application.
  4. Set Menu Title as Sublime Text (or Sublime Text.app, depending on your settings).
  5. Set Keyboard Shortcut as control+S. It will be shown as ^S. Or you can use any other shortcut which you prefer.
  6. Click/Tap on Add.

Now you can simply select the file and press control+S to open the file in Sublime Text.

4
  • 1
    Thank you, @Safwan - excellent tip. I had to change the Menu Title to "Sublime Text.app" (without quotes) for it to work; filename extensions were set to display in Finder, so the entry under File > Open With included the extension.
    – Miles
    Commented Aug 22, 2019 at 17:29
  • After testing in 10.14.6 a bit more, it turns out that Finder responds to the keyboard shortcut only sporadically; rebuilding the Launch Services database to fix the slow "Fetching..." bug or changing the shortcut to another combination did not resolve.
    – Miles
    Commented Aug 22, 2019 at 17:50
  • 1
    Here's what ended up working for my use case: assigning a keyboard shortcut to one of the Finder Services ("Open File in CotEditor") instead of relying on "Open With", "Other...", etc. A custom service shortcut can also be created for apps that don't offer one (e.g., Sublime Text).
    – Miles
    Commented Oct 3, 2019 at 22:45
  • 1
    This is smart. Note that, like Miles Wolbe, I had to add “.app” for it to work for me (I’ve added this to the text of the answer). For the curious, this is how this approach works: the “Open with” submenu for the Finder’s contextual menu lists possible apps. Since they are shown here, these app names are menu items that can be called using custom shortcuts set using System Preferences. Commented Jun 7, 2021 at 15:03
2

As requested , here is a capture of [my blog] post for an Automator Service that works for me in Yosemite .

enter image description here

Code for Applescript in step 2

on run {input, parameters}

    tell current application to activate


end run

Code for Applescript in step 5

on run {input, parameters}
    set theApp to (POSIX path of (item 1 of input))
    repeat with i from 2 to number of items in input
        set this_item to item i of input
        tell application theApp to open this_item
    end repeat
    tell application theApp to activate
end run

After Saving the Automator Service go to System Prefs. and add your shortcut to it.

enter image description here

1
  • Glad I followed through with this one, just had to discover some 'right'-clicking needed for your orange dotted-line instruction (at least that's how I got through it.) Thanks for posting Commented Dec 30, 2016 at 20:19
0

I have used FastScripts to assign a shortcut to this script. It can also be used to select the open recent menus in other applications.

try
    set l to {"Open With", "Open Recent", "Open Recent File", "Recent Projects", "Open Recent Set"}
    tell application "System Events" to tell (process 1 where it is frontmost)
        tell menu bar item 3 of menu bar 1
            click
            repeat with x in l
                try
                    menu item x of menu 1
                    click menu item x of menu 1
                    exit repeat
                end try
            end repeat
        end tell
    end tell
end try

I also used scripts like in 10.6 and earlier:

try
    tell application "Finder"
        open (get selection) using path to application "TextMate"
    end tell
end try

There is a bug that makes them unusable in 10.7 and 10.8 though. It could be avoided by focusing another application at the start, but it results in a visual glitch.

You could also use Automator services, but there is another bug where the shortcuts for services don't always work until the services menu has been shown from the menu bar.

1
  • The shorter solution (FastScripts) works flawlessly in 10.11, at least for opening file in Emacs.
    – Blaz
    Commented Oct 7, 2015 at 8:18
0

My favorite solution is using Better Touch Tool, a free app. For this to work you need to have Full Keyboard Access turned on (in system preferences - keyboard preferences - shortcuts), so that ctrl-f2 will access the menu bar.

Then use BTT to configure your short-cut (I use ctrl-alt-cmd-O) to do ctrl-f2, then attach addtional actions (10 times: two right arrows, then 7 down, then one right). When typing your shortcut you will get to the same submenu as you would get using the right mouse click and 'open with'.

Note that ctrl-f2 may not be displayed in BTT when you type it, but it does after you do 'attach additional action'.

-1

Right click on the file > press h key > use arrow keys to navigate

1
  • This does not appear to work on OS X 10.9. Do you have any third party utilities installed that may be providing this functionality? Commented Mar 6, 2014 at 17:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .