Limit the number of scrollback rows in Terminal on Mac
Terminal retains a log that lets you scroll back through all content typed by a user. Over time, the amount of information grows, making it difficult to scroll back through the content.
Using Terminal settings, you can change the number of rows retained in a session.
In the Terminal app on your Mac, choose Terminal > Settings, then click Profiles.
In the profiles list on the left, select a profile.
In the Scrollback section, select “Limit number of rows to,” then enter the number of rows.