I cannot get the default Finder "New Terminal at folder" service to work, no matter what. I've tried every trick I could find online.
So I created a new service and it appears in the Services list, but again, cannot get it to appear in the actual services menu nor does mapping a hotkey work.
The kicker is that this exact service was working for the last few months with no issues. Suddenly just stopped working. I haven't updated the OS or anything.
I'm on Sierra.
The script is below:
on run {input, parameters}
tell application "Finder"
set myWin to window 1
set theWin to (quoted form of POSIX path of (target of myWin as alias))
tell application "Terminal"
activate
tell window 1
do script "cd " & theWin
end tell
end tell
end tell
return input
end run
I really need this service to work, it saves me so much time and I really hate how it's not a reliable os feature.
Best Answer
macOS Sierra has two built-in Terminal Services, New Terminal at Folder and New Terminal Tab at Folder.
Go to System Preferences > Keyboard > Shortcuts > Services > Files and Folders, and check one or both and add a keyboard shortcut if you’d like.
Then in Finder you can select a Folder, right-click and select the service from the Services context menu, or from the Finder > Services menu or use the keyboard shortcut if assigned.
There’s no need to use AppleScript unless you really want to.
Here's some example AppleScript code that works of me:
Note: The example AppleScript code is just that and aside from the use of a
try
statement, does not employ any additional error handling and is meant only to show one of many ways accomplish a task. The onus is always upon the User to add/use appropriate error handling as needed/wanted.