Preferences
Profiles
Session
Warn about short-lived sessions
When enabled, you'll be given a warning if a session ends within a short time after it starts. This gives you a chance to see what went wrong and fix it.
“Undo” can revive a closed session for up to this many seconds
When you close a session, window, or tab the shell is not terminated until this many seconds pass. While that time period has not elapsed, Undo will reopen the session, tab, or window.
If Archive sessions on closure (below) is also on, Undo keeps working after this time runs out: the shell is gone by then, so the session comes back from its archive instead, in its original split pane, tab, and window. The 20 most recent archived closes can be undone even after iTerm2 restarts.
After a session ends
Defines what happens when a session ends.
- No Action - The session stays open and you will be prompted to restart it.
- Close - The session is automatically closed.
- Restart - The session is automatically restarted with the same command that launched it.
Prompt before closing
When a session will close, you can choose when to be prompted with a modal alert: Never, Always, or If there are jobs besides. If you select If there are jobs besides then the prompt will only be shown when an app besides those specified (which are often present when nothing is happening) is running.
Enable automatic session logging
If enabled, every session's output will be logged to a file in the specified directory. The filename format can also be specified here as an interpolated string.
Log format
You can log in the following formats:
- Raw data - An exact copy of the input that was received including control sequences.
- Plain text - Excludes control sequences. Just text and newlines. This is very readable when running CLI apps but becomes utter chaos for interactive programs like vim or emacs.
- HTML - Like Plain text, it excludes control sequences. Colors and various font attributes are preserved. The resulting file can be viewed in a web browser.
- asciinema - Produces a file viewable with asciinema, which preserves time as well as more font attributes.
Folder
The folder in which to place logs. This is an interpolated string.
Filename
The name to give the log file. This is an interpolated string.
Open password manager automatically when a password prompt is detected
If enabled, the password manager opens automatically when iTerm2 detects that a session with this profile is showing a password prompt.
Timestamps
When enabled, the last modified date and time of each line is shown on the right-hand side of the terminal. You can also select where timestamps are drawn: Over contents, Over contents when mouse hovers over scrollbar, or Next to contents.
Status bar enabled
See Status Bar for details on the status bar. Click Configure Status Bar to choose its components.
Show progress bars
When enabled, a thin progress bar is drawn at the top of the session when a program reports progress with the OSC 9;4 escape sequence. Height sets its thickness in points (it can't be taller than the top margin, so it never covers text), and Color Scheme sets the colors of both ordinary percentage bars and indeterminate ones (bars that show activity without a percentage). Bars reporting an error or warning keep their red or orange colors regardless of the scheme. On by default.
Periodically send an ASCII code when idle
If selected, the specified ASCII code (a number from 0 to 255) will be transmitted every Interval (seconds) seconds while nothing is happening. Don't use this unless you know what you're doing as it can have unexpected consequences. Seriously, it's probably not what you want.
Avoid repainting while cursor is hidden to reduce flicker while scrolling
When selected, the screen will slightly delay redraws while the cursor is hidden. This improves the visual appearance of scrolling in many programs but might introduce noticeable delays for some users.
Archive sessions on closure
When enabled, an archive of the session is saved automatically when it closes. Use the accompanying directory picker to choose where the archives are written. See Session Archives for details on what is captured and how to open an archive later.
Archiving also extends Undo: a closed session can be undone after the “Undo” time limit runs out, because it is restored from its archive. See the “Undo” setting above.
Lock pane by default
When enabled, new sessions with this profile start out locked. A locked pane can’t be moved by dragging, and closing it asks for confirmation.
Buffer input by default
When enabled, text you type in a new session with this profile is stored rather than sent, until you turn buffering off with Shell > Toggle Buffer Input (or a Buffer Input... trigger configured to stop buffering).
Prevent sleep
When Prevent the system from sleeping while a session has this setting on is enabled, your Mac won’t go to sleep due to inactivity while any session with this setting on exists (including buried sessions). It prevents only idle sleep: the display can still sleep, and closing the lid or choosing Sleep from the Apple menu still puts the Mac to sleep. A session whose program has ended but whose pane is still open doesn’t count. Off by default.
This only takes effect while the Mac is connected to power. To make it apply on battery too, turn on the advanced setting “Prevent system idle sleep on battery too, for profiles with ‘Prevent sleep’ enabled?” in Settings > Advanced.
Beneath the checkbox, iTerm2 shows how many sessions are currently preventing sleep, or how many would if the Mac weren’t on battery.
To keep the Mac awake only while a particular job runs (for example, an AI coding agent), leave this off and use a pair of Set Profile Setting triggers (for example, on the Job Started and Job Ended events) to turn it on when the job starts and off when it ends. A trigger changes the setting only for the session it fires in. See Triggers.
