18

I know this may have been asked several times, however I cannot find a valid method that will work for me.

On El Capitan - I want to add a option to the right click menu (not the services section) that allows me to open a file or directory directly in terminal from the right click option.

Would somebody be able to provide a working method?

5
  • What's wrong with Services? It already exists as an option there.
    – Tetsujin
    Nov 24, 2015 at 10:13
  • @Tetsujin - So far it doesn't allow me to open a file in terminal. Only Folders. I previously used XtraFinder which no longer works on El Capitan without disabling a seucrity feature of el capitan.
    – RandomMath
    Nov 24, 2015 at 10:14
  • hmm… ok. The service is actually 'Open Terminal at Folder' so I guess you're right
    – Tetsujin
    Nov 24, 2015 at 10:20
  • 1
    How do you want to open the file in terminal?
    – Joonas
    Nov 24, 2015 at 12:48
  • What would you expect it to do with a file?
    – Chris Page
    Nov 28, 2015 at 12:21

6 Answers 6

12

Exhibit A

As already mentioned in comments, using the built in service definitely works for folders. As for files, if you were to open them in finder, nothing would happen unless you can first established default editors in your .bash_profile.

If you're not dead set on using the right click menu, one way to open a folder location or file with terminal without downloading additional software would be to drag a file or folder onto your Terminal icon in the Dock. I do this often and it works great.

1
  • 1
    It may be worth pointing out where you can find the dialog pictured in the image here (System Preferences > Keyboard > Shortcuts or under [current application menu] > Services > Services Preferences); it's not entirely intuitive.
    – Weston C
    Mar 28, 2018 at 5:42
4

Here is a small tool that will do the job: https://github.com/qparis/FinderOpenTerminal

1
  • Your tool was great, I used to use it on a different Mac. I wanted to use it on a new machine I have but http://openterminal.quentin.paris/ is no longer valid. Could you please check?
    – Rui Santos
    Dec 7, 2021 at 14:25
3

As an addition You can add alias in Your .bash_profile:

alias cdf="eval \"cd \\\"\\\`osascript -e 'tell app \\\\\\\"Finder\\\\\\\" to return the POSIX path of (target of window 1 as alias)'\\\`\\\"\""

This will not solve your problem, but You can use existing Terminal window and cd to selected directory in Finder by cdf command.

1
  • I prefer this method. Just wanted to note that this is using the last active window if there are multiple windows open.
    – rwenz3l
    Apr 20, 2017 at 6:19
3

There are more utilities of this kind available. E.g. Go2Shell is also a possibility.

1
  • Can you please go in depth, for example describe what Go2Shell can do?
    – Brick
    May 17, 2016 at 12:10
0

BarryMode's answer creates a sub menu item and you have to be in the parent directory for the menu item to work on a given directory.

This tool solves both of these issues. It allows you to open terminal from any directory while you are in the directory. The tool also allows you to write simple shell scripts to add more custom options to the right click menu. The tool is free and there is a GitHub link on the tool's page if you want to check the source.

-2

When I upgraded to El Capitan, I was able to open terminal at finder as I was before and never had to try to make it work again.

0

You must log in to answer this question.

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