Macterm

Password Manager

A program in a pane can ask for a password: ssh, sudo, psql or a key passphrase. Macterm notices this, and a bubble appears at the cursor. Macterm never saves a password unless you say so. Macterm never types a password for you unless you ask.

Saving a password

Type the password as usual. When the password works (the login succeeds or the command runs), a bubble asks Save Password? The bubble shows the command and the password prompt. Press Return or click Save to save the password. Press Esc or click Cancel to forget it.

Macterm offers to save only a password that it saw work:

Autofill

Sometimes the same command shows the same password prompt again. The bubble then offers Autofill. Do one of these: press Return, click the button, or press ⌥⌘F (Autofill Password in Settings → Keymaps). Then confirm with Touch ID. On a Mac with no Touch ID, confirm with your login password. Macterm types the password and presses Return, as you would. Press Esc to put the bubble away. When you start to type, the keys are yours again.

Autofill happens only when you press the button. A program that shows a password prompt cannot make Macterm type. The bubble shows the command and the prompt line that the password is saved for. Read them before you press Return.

If a saved password stops working, the bubble says so. Type the new password. When it works, Macterm offers to update the saved password.

Typing a password on demand

Macterm cannot see some password prompts. Examples: sudo on a server that you reached with an ssh command that you typed in a pane, and a prompt inside tmux. A password that you added yourself can also have no prompt. For these cases, open the command palette (⌘P) and select Password Manager. You can also go there with View → Password Manager, or with a keybind that you give to Password Manager in Settings → Keymaps. It has no keybind by default. If you press the keybind again, the palette closes. The palette shows your saved passwords. Type to search them by command or by prompt. Select one to type it into the focused pane. Press Esc, or press Delete with nothing typed, to go back to the full palette.

As with Autofill, Macterm types the password after Touch ID. Your selection is the permission. Nothing asks whether the pane is at a password prompt. Macterm only decides if it presses Return after the password:

Adding a password yourself

Click + next to Saved Passwords in Settings → Password Manager. You can also select Add Password… in the Password Manager of the palette. While you search there, Add Password for Command: … starts a new password. It uses the text that you typed as the command. Each password that you add needs a command. The prompt is optional:

Key passphrases are an exception. A passphrase belongs to the key, for any command that asks. Macterm saves it from the prompt. Type the passphrase at its prompt one time and save it there.

What a password is saved for

Macterm files each password under two things: the command that asked and the prompt line that it printed. Both must match exactly before Macterm offers Autofill. Nothing else is part of the match. The project, the tab, the window and the working directory do not matter.

Examples:

There are two exceptions to the command rule:

Macterm offers these two shared entries only to a program that your own account cannot change or replace. The file of the program, and every folder above it, belongs to the system (/usr/bin/sudo, /usr/bin/ssh). Macterm keeps every other program apart. A program with the name sudo in ~/bin or /opt/homebrew/bin gets its own entries. The bubble shows its full path. Then it cannot get your login password as if it were the real sudo. When a program outside the system folders asks for a passphrase (Homebrew's ssh, for example), Macterm saves the passphrase for that program only.

If Macterm cannot tell which program asks, it offers no Autofill and no save for that prompt.

Details… in Settings → Password Manager shows the exact command and the prompt that an entry matches. You can edit them. If you clear the prompt, the entry is only for the palette. You cannot clear the command. An entry for a prompt from any command (a key passphrase) stays that way.

Password prompts on a remote host

A pane of a remote project runs its shell on the host. A password prompt there, for example sudo on the host, shows the same bubble as a password prompt on your Mac. Save Password? and Autofill work as described above.

The bubble needs Macterm's server on the host. That server tells Macterm when the shell on the host reads a password. In these cases, no bubble appears, and the password prompt shows in the pane as usual. Type the password, or type a saved password on demand.

An ssh command that you typed in a pane shows no bubble on any host. Macterm sees only the local ssh client, which reads your keys in raw mode. Macterm cannot see a password prompt on the far side of that ssh.

Where passwords are stored

Macterm stores passwords in your login keychain (~/Library/Keychains/login.keychain-db). This is the file-based keychain where most Mac apps keep their passwords. Each password is one generic-password item:

Keychain Access field Value
Name Macterm: <command>. For an entry of a host, the host follows in parentheses.
Kind Macterm terminal password
Where (service) com.thdxg.macterm.passwords
Account The command and the prompt that it matches. For an entry of a host, <host> › comes first.

You can see the items in Keychain Access (login keychain → Passwords, search "Macterm"). Macterm does not sync them to iCloud Keychain or to your other Macs. If you remove Macterm, the items stay. Remove them first in Settings → Password Manager, or in Keychain Access.

Your login password locks the login keychain. It unlocks when you log in. The access list of each item trusts only the code signature of Macterm. Any other app, and the security command, shows the system dialog "wants to use your confidential information" when it asks to read an item. That dialog needs your login password.

Who can read them

Macterm is the terminal, so every key that you type already passes through it. At a password prompt, Macterm keeps a copy of the line in memory. It uses the copy to judge if the password worked. Macterm drops the copy when the verdict arrives, after 12 seconds at most. An exception is a save offer. The copy then stays in memory until you answer the offer, run another command, or 15 minutes pass. Macterm never writes the copy to disk unless you click Save.

While a pane is at a password prompt, Macterm also turns on macOS Secure Keyboard Entry. Other apps then cannot read the keys that you type there. This follows the ghostty key macos-auto-secure-input (on by default).

Touch ID and your other setups

Macterm does not change any system authentication setting. Its authentication request is the standard macOS request ("Macterm is trying to autofill the password for …"). Macterm itself asks for it. Macterm does not touch PAM, the configuration of sudo, your ssh agent or the settings of your keychain.

Settings → Password Manager

Setting What it does
Enable password manager On (the default): Macterm offers to save passwords and offers autofill. Off: Macterm does not save, capture or fill in anything. The Password Manager of the palette is also off. The setting below is disabled.
Require authentication Once per app launch (the default) or Every time. With Once per app launch, Macterm also asks again after the Mac locks or sleeps.
Saved Passwords Search the list. + adds a password. The menu of a row has Details…, Copy Password and Remove. Details… shows the full command and prompt, which you can edit. After you authenticate, it shows the password, which you can copy or change.

To turn the feature off, switch off Enable password manager. Macterm then never keeps a copy of what you type at a password prompt, never shows a bubble and never fills in anything. The passwords that you already saved stay in your keychain until you remove them. The list stays available for that. Macterm still notices password prompts, because that also turns on Secure Keyboard Entry.

Limits

Macterm detects a password prompt by the terminal mode in which the program reads it (input by line, echo off). Ghostty and iTerm2 use the same rule for secure input. This covers local panes, the own ssh login of a remote project, and the panes of a remote project that run on Macterm's server. It does not cover a password prompt after an ssh command that you typed in a pane, for example sudo on a server that you reached that way. It also does not cover prompts that draw their own * characters. For these, type the password on demand.