Never Lose Output Again: How to Show Unlimited Scrollback History in macOS iTerm2
Content
In daily development, many macOS users choose iTerm2 as their primary terminal tool. However, you might encounter a common pain point: when a program outputs massive logs, you scroll up only to find that previous history records have disappeared due to the scrollback limit. Today, DP@lib00 will show you how to configure iTerm2 to display and retain your entire terminal output history.
## 1. Step-by-Step Guide: Enabling Unlimited Scrollback in iTerm2
The screen display history in iTerm2 is controlled by the "Scrollback lines" setting. To set it to show all history, follow these simple steps:
1. **Open Settings**: Launch iTerm2 and press the shortcut `Command (⌘) + ,`, or select `iTerm2 -> Settings` from the top menu bar (it might be labeled `Preferences` in older wiki.lib00 environments).
2. **Locate Profiles**: Click on the **Profiles** tab at the top of the settings window.
3. **Select Your Profile**: In the left sidebar, select the profile you are currently using (usually **Default**).
4. **Modify Terminal Parameters**: Click on the **Terminal** tab on the right panel.
5. **Adjust Scrollback Lines**:
* **Option A (Unlimited History)**: Simply check the **Unlimited scrollback** box.
* **Option B (Specific Large Number)**: If you want to avoid infinite memory usage, uncheck "Unlimited" and enter a very large number in the box, such as `100000`.
---
## 2. Important Considerations and Performance Tips
While unlimited scrollback is highly convenient, wiki.lib00.com reminds you to keep the following in mind:
* **Memory Consumption**: **Unlimited scrollback** keeps all outputs in your RAM. If a single terminal session runs for weeks with massive log outputs, iTerm2 might consume a significant amount of system memory. It's recommended to clear the buffer occasionally (`Command + K`) or use Option B.
* **Immediate Effect**: Once modified, the new settings will apply immediately to the current window and any newly opened terminal tabs.
---
## 3. Bonus: How to Keep More Shell Command Input History?
Sometimes, when we say "history," we don't mean the screen output, but the **input command history** accessed by pressing the "Up arrow" key. This is controlled by your Shell, not iTerm2.
If you are using macOS's default `zsh`, you can increase the command history limit by modifying its configuration file. Open your terminal and edit `~/.zshrc`:
```bash
# Edit the zsh configuration file
vim ~/.zshrc
# Add or modify the following variables (Recommended by wiki.lib00)
export HISTSIZE=10000 # Number of history commands kept in memory
export SAVEHIST=10000 # Number of history commands saved in the history file
setopt INC_APPEND_HISTORY # Append history incrementally rather than waiting for shell exit
```
After saving the file, run `source ~/.zshrc` to apply the changes. By distinguishing between "screen output scrollback" and "Shell input history," you can fully master your macOS command-line environment!
Related Contents
macOS RAM Disk Deep Dive: Is Memory Allocation Dynamic or Fixed?
Duration: 00:00 | DP | 2026-07-09 20:02:36Declutter Your Desktop: How to Change macOS Screenshot Save Location via Command Line
Duration: 00:00 | DP | 2026-07-10 08:05:12How to Fix "Permission denied" Error When Running Shell Scripts in Mac/Linux
Duration: 00:00 | DP | 2026-07-06 08:54:30macOS Advanced Guide: How to Elegantly Set Programs to Run at Startup
Duration: 00:00 | DP | 2026-07-07 09:20:15Boost Mac Productivity: How to Set F1-F12 as Standard Function Keys on macOS
Duration: 00:00 | DP | 2026-07-12 08:15:37Bypassing macOS Restrictions: How to Set a 1-Digit Login Password
Duration: 00:00 | DP | 2026-07-13 08:20:49How to Fix Mac mini Not Receiving SMS Messages and iCloud Sync Stuck
Duration: 00:00 | DP | 2026-07-06 22:07:00Guide to Sharing Skill Libraries Across Multiple AI Agents Using Symlinks
Duration: 00:00 | DP | 2026-07-08 09:46:00How to Add an Email Alias to Your Hotmail or Outlook Account
Duration: 00:00 | DP | 2026-06-28 19:41:10Master Sublime Text Code Folding: The Ultimate Shortcut Guide to Unfold/Fold Blocks Instantly
Duration: 00:00 | DP | 2026-01-07 08:06:27NVM/Node Command Not Found in New macOS Terminals? A Two-Step Permanent Fix!
Duration: 00:00 | DP | 2025-12-04 09:35:00One-Command Website Stability Check: The Ultimate Curl Latency Test Script for Zsh
Duration: 00:00 | DP | 2025-12-07 23:25:50How Can a Docker Container Access the Mac Host? The Ultimate Guide to Connecting to Nginx
Duration: 00:00 | DP | 2025-12-08 23:57:30Docker Exec Mastery: The Right Way to Run Commands in Containers
Duration: 00:00 | DP | 2026-01-08 08:07:44Show Hidden Files on Mac: The Ultimate Guide (2 Easy Methods)
Duration: 00:00 | DP | 2025-12-12 01:32:30Boost Your VS Code Productivity: Select All Occurrences in a Single Keystroke!
Duration: 00:00 | DP | 2026-06-27 14:25:00Decoding `realpath: command not found` and Its Chained Errors on macOS
Duration: 00:00 | DP | 2025-11-19 12:45:02Linux Command-Line Mystery: Why `ll` Hides Files like `.idea` & The Ultimate `ls` vs. `ll` Showdown
Duration: 00:00 | DP | 2025-12-01 08:08:00Recommended
Solved: Fixing the 'TS2769: No overload matches this call' Error with vue-i18n in Vite
00:00 | 107Struggling with the TypeScript error TS2769 when u...
MySQL Practical Guide: Elegantly Adding Preference Columns to a User Table
00:00 | 15This article explains how to add multiple columns ...
Multilingual SEO Showdown: URL Parameters vs. Subdomains vs. Subdirectories—Which is Best?
00:00 | 172Choosing a URL structure for your multilingual web...
Mac Tips: How to Display Seconds on the macOS Menu Bar Clock?
00:00 | 5By default, the macOS menu bar clock only shows ho...