Just moved off from windows into a Mac. I used to use Putty and it has a feature of logging sessions into a folder so everything that happens (stdin/out) goes also to a folder for historic record.
I would like to have the same thing with Mac Terminal app.

There are two ways I am aware of:

  1. Run all the commands you want in Terminal. Before closing the window go to Shell -> Export Text As… (or press CMD+S). This exports a text file with all the input and output of that session.
  2. Start script at the beginning of your session, e.g. with: /usr/bin/script ~/Desktop/Terminal.log. When you’re done with the session type exit and a log file with all the input/output will be written (an example can be found in this other answer).

I found that the first method handles colours in the output better: it simply ignores it and writes the text to the file.
The script method writes control characters such as [1m[0m[1m[36m instead, which creates noise in your log. If you don’t have any coloured output, that’s no problem. If you do, perhaps there’s an option for script that can handle this.

1

You must log in to answer this question.

Not the answer you’re looking for? Browse other questions tagged .