Skip to content
solarhellPublic

About

Open terminal from Finder toolbar | 从 Finder 工具栏快速打开终端

Topics

Resources

Stars

31 stars

Watchers

1 watching

Forks

Repository files navigation

go2shell

中文文档

Quickly open a terminal from the current Finder directory.

macOS Swift

settings

Features

  • One-click launch — Open a terminal right from the Finder toolbar
  • Smart detection — Automatically detects installed terminal apps
  • Native icons — Displays each terminal's real app icon
  • Pure Swift, lightweight and fast
  • Simple to use, no complex configuration needed

Supported Terminals

The app auto-detects the following terminals. Uninstalled ones are greyed out:

  • Terminal.app (built-in)
  • iTerm2
  • Warp
  • Ghostty
  • WezTerm
  • Kitty
  • Alacritty

If the preferred terminal is uninstalled, it automatically falls back to the built-in Terminal.app.

Install

Homebrew (recommended)

# Trust the cask (one-time; needed on Homebrew ≥ 5.1.15, skip on older versions)
brew trust --cask solarhell/tap/solarhell-go2shell

# Install
brew install solarhell/tap/solarhell-go2shell

# Upgrade
brew upgrade solarhell/tap/solarhell-go2shell

Upgrading from an older install? The cask was renamed from go2shell to solarhell-go2shell to avoid a name collision with the unrelated go2shell cask in homebrew/cask. Trust entries are stored per token and are not carried over by the rename, so trust the new token first, then migrate:

brew trust --cask solarhell/tap/solarhell-go2shell
brew migrate --cask solarhell/tap/go2shell

Build from source

make install

# Then drag go2shell.app from /Applications to the Finder toolbar
# (hold ⌘ while dragging)

# Done! Click the toolbar icon to open a terminal in the current directory.

Note: The app is not notarized. macOS Gatekeeper may block it on first launch. To bypass:

xattr -d com.apple.quarantine /Applications/go2shell.app

Or go to System Settings > Privacy & Security and click "Open Anyway".

Usage

Step 1: Add to Finder Toolbar

  1. Open the Applications folder
  2. Hold ⌘ (Command)
  3. Drag go2shell.app onto any Finder window's toolbar
  4. Done!

Step 3: Use

  • Click the go2shell icon in any Finder window's toolbar
  • A terminal opens at the current directory automatically
  • Hold ⇧ Shift while clicking to pick a terminal from a menu just this once (default terminal first; press Return, a number key, or click). Turn on Show terminal menu on click in settings to always show it
  • The menu also has Settings… to open the settings window
  • Don't hold ⌥ Option while clicking: Finder treats it as "open and close this window"

Change Settings

Option 1: Settings window

  • Shift-click go2shell in the Finder toolbar and choose Settings…
  • Or double-click the app in the Applications folder
  • Select your preferred terminal, and optionally turn on Show terminal menu on click

Option 2: Command line

open /Applications/go2shell.app --args --show-ui

Option 3: Defaults

# Always show the terminal menu on click
defaults write com.solarhell.go2shell ShowTerminalMenu -bool true

# Set to Terminal.app (default)
defaults write com.solarhell.go2shell PreferredTerminal Terminal

# Set to iTerm2
defaults write com.solarhell.go2shell PreferredTerminal iTerm

# Set to Warp / Ghostty / WezTerm / Kitty / Alacritty
defaults write com.solarhell.go2shell PreferredTerminal Warp
defaults write com.solarhell.go2shell PreferredTerminal Ghostty
defaults write com.solarhell.go2shell PreferredTerminal WezTerm
defaults write com.solarhell.go2shell PreferredTerminal Kitty
defaults write com.solarhell.go2shell PreferredTerminal Alacritty

System Requirements

  • macOS Sequoia 15.0+
  • Xcode 16+ (for building)

Build

Built with Swift Package Manager and Makefile.

Using Makefile (recommended)

make help      # Show all commands
make build     # Build the app
make install   # Install to /Applications
make clean     # Clean build files
make debug     # Show debug info

Using SPM directly

swift build -c release
.build/release/go2shell

Note: SPM alone only compiles the binary. Use make build to create a full App Bundle.

How It Works

  1. Uses Apple Events (AppleScript) to get the frontmost Finder window's path
  2. Falls back to the Desktop path if no Finder window is open
  3. Opens the folder with the preferred terminal via NSWorkspace (same as open -a <Terminal> <folder>, no shell involved, so spaces, quotes and other special characters need no escaping). Folders under /Applications open the settings window instead, since that is how double-clicking the app is detected
  4. Exits automatically after launching the terminal; if launching fails, an alert shows the reason

Troubleshooting

If clicking the toolbar icon does nothing or opens the wrong folder, stream go2shell's logs and click the icon again:

log stream --predicate 'subsystem == "com.solarhell.go2shell"' --level info

Or look at the last few minutes:

log show --last 10m --predicate 'subsystem == "com.solarhell.go2shell"' --info

Common causes:

  • Desktop opens instead of the current folder — check the log:
    • Cannot read Finder selection — go2shell can't talk to Finder. Allow it under System Settings > Privacy & Security > Automation > go2shell > Finder.
    • Front Finder window has no folder target — nothing is selected and the front window is Recents, AirDrop, search results or a similar view without a folder. Open a real folder, or select an item (go2shell then opens the item's folder).
    • Selected item is not a Finder item — the current selection can't be resolved to a file. Deselect it (click empty space) and try again.
  • Wrong terminal opens — the preferred terminal wasn't found (detected by bundle ID, so it may live anywhere, e.g. ~/Applications); go2shell falls back to Terminal.app.

Project Structure

go2shell/
├── Package.swift              # SPM configuration
├── Makefile                   # Build automation
├── Sources/
│   ├── main.swift             # Entry point
│   ├── Views.swift            # SwiftUI interface
│   ├── TerminalManager.swift  # Terminal launch logic
│   ├── TerminalMenu.swift     # Terminal picker menu (Shift + click)
│   ├── Log.swift              # Unified logging (os.Logger)
│   ├── Finder.swift           # Finder ScriptingBridge
│   └── FinderManager.swift    # Finder path retrieval
├── Resources/
│   ├── Info.plist             # App configuration
│   ├── go2shell.entitlements  # App entitlements
│   └── AppIcon.icns           # App icon
└── .build/                    # Build output (generated)

Roadmap

  • Support Terminal.app, iTerm2, Warp, Ghostty, WezTerm, Kitty, Alacritty
  • Native app icons
  • Grey out uninstalled terminals, auto-fallback on uninstall
  • Open in new tab or new window
  • Keyboard shortcuts
  • Custom terminal commands (e.g., run a script after cd)

License

MIT

About

Open terminal from Finder toolbar | 从 Finder 工具栏快速打开终端

Topics

Resources

Stars

31 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages