Term At Target
This guide shows how to open Terminal at a Finder location using a Shortcut and AppleScript.
What It Does
Section titled “What It Does”This Shortcut can:
- Open Terminal at a selected Finder location.
- Handle files, folders, and Finder aliases.
- Ask whether to open inside a selected folder or at its parent level.
- Ask whether alias selection should use alias location or target location.
- Prevent immediate duplicate launches with a run lock.
Requirements
Section titled “Requirements”- macOS with Shortcuts app and Terminal app.
- Shortcut includes:
Get Selected Files in FinderRun AppleScript
How to Install
Section titled “How to Install”Step 1: Create the Shortcut
Section titled “Step 1: Create the Shortcut”- Open the Shortcuts app.
- Click
+to create a new Shortcut. - Name it
Open Terminal in Folder. - Add
Get Selected Files in Finder. - Add
Run AppleScript.

Step 2: Add the AppleScript
Section titled “Step 2: Add the AppleScript”- Open TermAtTarget.applescript.
- Copy the raw script.
- Return to Shortcuts.
- Click inside the
Run AppleScriptaction. - Paste the script.
- Click outside the action so changes are saved.

Step 3: Configure Shortcut Details
Section titled “Step 3: Configure Shortcut Details”- Open Shortcut Details (
ibutton). - In
Details, enableUse as Quick Action. - Enable Finder and Services Menu options.

How to Use
Section titled “How to Use”Basic Usage
Section titled “Basic Usage”- Open Finder.
- Select a folder, file, or alias.
- Run the Shortcut from Quick Actions or Services.
If You Select a Folder
Section titled “If You Select a Folder”You can choose:
Open Terminal INSIDE this folderOpen Terminal at this folder's LEVEL
If You Select a File
Section titled “If You Select a File”Terminal opens at the file’s containing folder.
If You Select a Finder Alias
Section titled “If You Select a Finder Alias”You can choose:
Open Terminal at TARGET locationOpen Terminal at ALIAS location
If target is a folder and you choose TARGET, folder behavior still applies (INSIDE or LEVEL).
If Nothing Is Selected
Section titled “If Nothing Is Selected”The script prompts you to choose a folder.
Customization
Section titled “Customization”Edit these properties in the AppleScript:
property defaultFolderAction : "ASK" -- ASK, INSIDE, LEVELproperty defaultAliasAction : "ASK" -- ASK, TARGET, ALIASFolder action behavior:
ASK- Prompt every run.INSIDE- Always open inside selected folder.LEVEL- Always open at parent of selected folder.
Alias action behavior:
ASK- Prompt every run.TARGET- Always use alias target location.ALIAS- Always use alias file location.
Troubleshooting
Section titled “Troubleshooting”- If files/folders are duplicated, check keyboard shortcut conflicts first.
- Do not assign this Shortcut to
⌘D(Finder Duplicate). - If Terminal opens twice, check that Shortcut trigger is not assigned in multiple places.
- Confirm Finder and Terminal permissions when prompted by macOS.
Technical Notes
Section titled “Technical Notes”- Terminal launch uses
open -a Terminal <path>, rather than AppleScript’s direct Terminal handling. This approach prevents an issue where two Terminal windows would open simultaneously. - Script returns
{}to avoid passing Finder input downstream. - Alias and folder routing is handled explicitly through script options.
Created by Ervins Strauhmanis. Licensed under MIT.
Current version: 1.3.0.