You can get an instant command line anywhere on your Mac with iTerm2 by assigning a global hotkey that shows or hides a terminal window over any app. This gives you a drop-down terminal (like the console in a game) that appears with one keystroke and disappears when you’re done, without losing your place in your current application. This article explains how to set that up, how to make it work reliably, and what to do when it doesn’t.
What Is a Global Hotkey Window?
iTerm2, the popular Mac terminal replacement, includes a feature called a “Hotkey Window.” It’s a special iTerm2 profile that binds a keyboard shortcut to a terminal window. When you press the shortcut, the window slides in from the top of the screen, focused and ready for input. Press it again (or click away) and it slides back out. The terminal keeps running in the background, so your SSH sessions, running servers, or `vim` buffers stay alive while the window is hidden.
This is different from simply opening Terminal.app or iTerm2 from the Dock. A hotkey window is always one keystroke away, regardless of what app is frontmost. It’s the closest thing to a “command line anywhere” on macOS.
How to Set It Up in iTerm2
The setup takes about two minutes. Here are the steps for a current iTerm2 version (3.5.x or later):
- Open iTerm2 and go to Settings (Cmd+,).
- Click the Keys tab, then click Hotkey in the left sidebar.
- Check Show/hide all windows with a system-wide hotkey.
- Click the Hotkey field and press your preferred key combo. A common choice is
Ctrl+`(Control plus backtick) orCmd+Shift+Space. Avoid combos that conflict with other apps. - Close Settings. Press the hotkey from any app—the terminal appears.
If you want the window to be a specific size or style, create a dedicated profile: go to Settings > Profiles, click Other Actions (the gear icon), and select Duplicate Profile. Name it “Hotkey Window.” Then, in the Keys tab, under Hotkey, choose Create a dedicated hotkey window and pick that profile. This lets you set a different background, transparency, or size for the drop-down terminal.
Why It Works: The Terminal Is Just an App
On macOS, every app can have a global hotkey if it implements the right API. iTerm2 uses the Carbon hotkey API (the same one used by many utility apps) to register a system-wide key event. When the hotkey is pressed, iTerm2 brings its window to the front and gives it focus. When you press it again, it hides the window but does not quit the app or kill the shell processes.
This is why the hotkey window feels instant: the shell is already running, and the window is just being shown or hidden. There’s no startup delay, no new process spawn, and no need to navigate to the Terminal app.
Common Problems and Fixes
Here are the most frequent issues people hit and how to resolve them:
- Hotkey doesn’t work from some apps. Some apps (especially games or full-screen apps) may intercept the key. Try a different combo, or check if the app has its own global hotkey that conflicts.
- Hotkey works but the window is behind the current app. In iTerm2 Settings > Keys > Hotkey, make sure Animate is on and that the window is set to “floating” (in the profile’s Window settings, enable Floating window). This keeps it above other windows.
- Terminal opens on the wrong screen. If you have multiple monitors, the hotkey window appears on the screen with the menu bar. To change that, move the window to the desired screen while it’s visible, then hide and show it again—iTerm2 remembers the position.
- Hotkey stops working after a macOS update. Re-check the Settings; sometimes permissions for accessibility or input monitoring get reset. Go to System Settings > Privacy & Security and make sure iTerm2 is allowed under Input Monitoring (and Accessibility if you use advanced features).
Alternatives: Other Ways to Get a Terminal Anywhere
If iTerm2 isn’t your thing, there are other options:
- Terminal.app has a similar feature: Settings > Profiles > Window, then set a shortcut key under the Keyboard tab. It’s less flexible but built-in.
- Visor (a plugin for older macOS) was the original drop-down terminal, but it’s no longer maintained.
- Alacritty or Kitty are fast terminals, but they don’t have a built-in global hotkey; you’d need a third-party tool like Hammerspoon or BetterTouchTool to bind a key to show/hide them.
- tmux inside a regular terminal gives you persistent sessions, but it doesn’t solve the “anywhere” part—you still need to open a terminal window.
Is It Safe? Security and Privacy Notes
A global hotkey terminal is safe as long as you lock your screen when you step away. The hotkey window is just a terminal; anyone who presses the hotkey gets a shell with your user privileges. If you’re on a shared Mac, consider disabling the hotkey when you’re not using it, or use a hotkey that’s hard to guess.
Also note that iTerm2 may request Input Monitoring permission on first run. This is normal—macOS requires it for any app that listens for global key events. Grant it only if you trust the app; iTerm2 is open-source and widely used, but you should verify the source if you download it from anywhere other than the official site.
Frequently Asked Questions
Can I use the hotkey window for a specific SSH session?
Yes. Just start an SSH session in the hotkey window profile. It stays alive when the window is hidden. You can even have multiple tabs in the hotkey window, each with a different session.
Does the hotkey window work in full-screen apps?
Yes, but the terminal may appear as a separate space (if you’re using full-screen spaces). To avoid that, make the hotkey window “floating” and it will overlay the full-screen app. Some apps (like video players) may still block it.
Can I change the hotkey after setup?
Yes, go back to Settings > Keys > Hotkey and press a new combination. The old one is removed automatically.
Why is my hotkey window transparent or with a different background?
That’s because you have a dedicated profile for the hotkey window. Edit that profile’s Appearance settings to change transparency, blur, or background image. If you want it to look like your normal terminal, just use the default profile instead of a custom one.
Does this work on Apple Silicon Macs?
Yes, iTerm2 runs natively on Apple Silicon, and the hotkey feature behaves the same as on Intel Macs.
Can I have two different hotkey windows with different profiles?
Yes. Create two profiles, then in Settings > Keys > Hotkey, click the + button to add multiple hotkey windows, each assigned to a different profile and a different key combo.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Secure Boot Battlefield 6 ASUS: Fix & Enable Guide
- Best Tech Websites to Follow for Pros & Beginners
- Second Wind Quest Walkthrough: Where Winds Meet6.00 min/km
- Enshrouded Weapon Upgrade Guide: How to Improve Gear5.00 min/km
- Connect Phone to Controller for Cloud Gaming
- Python Search Highlighting: Snippets & Matches