Copy the output of the last command in 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.