With the default Terminal.app, one can select the previous command output with Cmd + Shift + A and then copy it with Cmd + C (source).

Is there a similar shortcut for iTerm2?


I figured out the solution:

  • Install Shell Integration: iTerm2 > Install Shell Integration
  • Restart iTerm2
  • Run some command that produces output, e.g. pwd
  • Verify that Edit > Select Output of Last Command is enabled, and that the shortcut Cmd + Shift + A works as well.

It works exactly the same for iTerm2 at least in El Capitan.

  • It does not work for me on El Capitan. Or is it a configuration issue in iTerm2? – Juuso Ohtonen Aug 20 '17 at 15:47
  • Thanks to you @Vivien, I figured out what the problem was and added it as an answer. – Juuso Ohtonen Aug 20 '17 at 16:19
  • Nice clarification @JuusoOhtonen. I didn't thought about Shell Integration. It seems I had all the steps done right without trying :) – Vivien Garcia Aug 21 '17 at 2:00

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.