Table of Contents

Password Manager

Overview

iTerm2 has a password manager that saves your passwords and types them into a session for you, so you don’t have to copy and paste them or type them yourself. Open it with Window > Password Manager (⌥⌘F). It opens as a sheet on the current window, or in a window of its own if no terminal window is open.

The built-in web browser has its own password manager, separate from the one for terminal sessions. When the current session is a browser session, Window > Password Manager opens the browser’s password manager instead. The two work the same way except where noted below.

Storage

By default passwords are saved in the macOS Keychain. Instead, you can use an existing password manager. Choose where passwords are stored from the gear menu at the bottom of the password manager window:

  • macOS Keychain
  • 1Password Integration
  • LastPass Integration
  • KeePassXC Integration
  • Bitwarden Integration
  • Keeper Security

The integrations use your password manager’s command-line tool (for example, op for 1Password and lpass for LastPass). The first time you choose one, iTerm2 walks you through setting it up. Reset Integration Configuration in the gear menu erases iTerm2’s settings for the current integration so you can set it up again; it doesn’t change the passwords themselves. Switch Account is available for integrations that support more than one account. Reload Items fetches the list of accounts again from where passwords are stored, for example after you’ve added or changed a password in the other password manager while iTerm2’s password manager was open.

Using the Password Manager

Search for an account by typing in the search field at the top. Select an account and click Enter Password to type its password into the current session. Enter User Name types the account’s user name. If you type a code into the 2-Factor Code field, it is appended to the password. Turn on Broadcast (⌘B) to send it to every session that receives broadcast input (Shell > Broadcast Input) as well.

The + and - buttons add and remove accounts, and Edit changes the selected account. When adding an account, the dice button generates a random password; hold Option while clicking it to use only letters and digits.

Right-click an account for these actions:

  • Reveal Password shows the password.
  • Copy Password copies it to the pasteboard.
  • Append OTP toggles whether the account’s one-time password is appended to its password when it is entered. It’s available only for accounts that have a one-time password in an integrated password manager.

The gear menu in the terminal password manager also has these settings:

Probe Before Sending Password

When enabled, iTerm2 checks that the session isn’t echoing what you type before it sends the password, so the password doesn’t appear on screen if you weren’t actually at a password prompt.

Automatically Send Return Key after Password

When enabled, a newline is sent after the password.

Other ways to open the password manager:

  • The Open Password Manager trigger opens it when a password prompt appears, with an account selected.
  • The profile setting Settings > Profiles > Session > Open password manager automatically when a password prompt is detected opens it whenever iTerm2 detects that the session is waiting for a password. It’s off by default.
  • In a browser session, a button appears in user name and password fields on web pages. Click it to pick a saved login and fill it in.

Authentication

The password manager can ask for Touch ID or your login password before showing your passwords. Choose how often it asks in the gear menu:

  • Don’t Require Authentication
  • Require Authentication Once per Launch (the default)
  • Require Authentication Once per Launch and after Screen Locks
  • Require Authentication on Every Open

With Require Authentication Once per Launch and after Screen Locks or Require Authentication on Every Open, locking the screen closes the password manager if it is open, so whoever unlocks the screen must authenticate again to see your passwords.

This setting applies to both the terminal and browser password managers. Because it protects your passwords, changing whether authentication is required, or whether it is required on every open, asks for an administrator password.

Exporting and Importing Passwords

Passwords saved in the macOS Keychain can be exported to a file and imported on another Mac. Passwords stored in other password managers can’t be exported this way; use that password manager’s own export instead.

To export, choose Export Passwords… from the gear menu. iTerm2 asks you to authenticate with Touch ID or your login password (even if the password manager doesn’t otherwise require it), then asks where to save the file and for a passphrase. The file, which has the extension .iterm2passwords, is encrypted with that passphrase, and you’ll need the passphrase to import it. The terminal password manager exports terminal passwords and the browser password manager exports browser passwords.

To import, choose Import Passwords… from the gear menu, or double-click a .iterm2passwords file in Finder. After you authenticate and enter the file’s passphrase, iTerm2 adds the passwords. Passwords can only be imported into a password manager that uses the macOS Keychain. If a password for the same account is already saved with a different value, you’re asked whether to replace it: Replace, Don’t Replace, or Always Replace and Never Replace to answer for the rest of the import. When it finishes, iTerm2 shows how many passwords were added, replaced, and kept.

Settings > General > Export All Settings and Data… can include your Keychain passwords, too. Turn on Include saved passwords (encrypted with a passphrase) in the save panel. It’s off every time, because the file holds every password. When you import that file with Import All Settings and Data…, iTerm2 asks for the passphrase; cancel to import everything except the passwords.