Mac quickly opens the terminal in the current folder

Mac quickly opens the terminal in the current folder

The system comes with shortcut keys

Settings-Keyboard-Shortcut keys
Services-Files and Folders-New terminal located in the folder location

Disadvantages: You must select the folder you want to open
. If you want to open a/b/c, you need to locate the location of b, select the c folder, and press the shortcut key. It
cannot be opened inside c.

Based on AppleScript and automation

Idea: Automatic operation of creating new TXT (Type 4)

  • Turn on automation
  • New application
  • Paste code
 on run {input, parameters}
    tell application "Finder"
    set currFolder to POSIX path of (folder of the front window as string)
    end tell
    tell application "Terminal"
    do script ("cd " & "'" & currFolder & "'")
    end tell
end run


  • save app
  • Hold down cmd and drag the app to the finder bar

Now you can locate a/b/c, click the app on the bar in c to open the terminal located in c

Insert image description here

ps. You can draw the icon yourself, copy it, open the profile, select the icon, and paste it to change the app icon.

Guess you like

Origin blog.csdn.net/weixin_43093163/article/details/131074213