Tmux iterm23/6/2023 ![]() ![]() Oh My ZshĪ big shoutout to Robby Russell for creating this gem. So, to install ZSH in your Mac, all you do is: Once you have it installed, you can run the command zsh to start the Z Shell. I feel Z shell increases productivity a lot, but personal opinion. I have been using Z Shell for quite some time and have been used to the commands and ways so much, it is a little difficult to use bash. All you need to do is unzip and put it into Applications folder and you are ready to use it. You can download and unzip iTerm2 from here. The main reason is it comes with more customising options and better color support more than anything else. So the very first step is to forget using the default terminal, and use iTerm2. The very first question was "Is the default terminal of Mac good?" Well, it's good enough, but most of the digging into led me to the same answer - Use iTerm2. So, when I started using a Macbook, the first question (apart from when to use CMD and CTRL) was which terminal and how to set it up with zsh and tmux. Here I am going to talk mainly about the terminal (yes, I am just gonna call that throughout). `attach` attaches to the default session that I created prior.Being a linux user for most part of my developer life, the most important thing of my life is the terminal (or shell or command line or console or whatever you want to call it) followed by text editor. CC tells tmux to start a control channel and disable echo (required by iTerm's tmux integration) u is a tmux option to force it in Unicode mode, required by iTerm's Tmux integration Unfortunately Apple continues to bundle old versions of tmux in macOS, and last I checked the one that was bundled didn't actually support the Control Channel required by iTerm integration. I'm specifying the /opt/local/bin version of tmux, because that's an updated one I've installed from MacPorts. The -t is the SSH option to force pseudo-terminal allocation, which some versions of ssh fail to do when passing a command (in this case tmux) rather than starting a shell. Ssh -t /opt/local/bin/tmux -u -CC attach I can even split/move panes like normal iTerm panes (though that crashed iTerm until about a year ago). Everything behaves like a normal iTerm window. Gone are all the usual tmux C-b prefixes to managing windows, non-integrated scrolling, etc. And if I get disconnected (frequent, with a laptop, as I'm moving around), I can reconnect and get all the remote windows just fine. ![]() Tmux integration works over SSH, so thanks to this I can have native-looking tabs and windows that are actually terminals on a remote machine. The awesome benefit for me is when using a remote tmux. I don't think there's much benefit to using tmux integration for a local shell, other than possibly long-lasting sessions that will survive iTerm itself crashing (and maybe you logging out? I'm not sure), which isn't enough of a problem for me to have to work around. I use tmux with iTerm regularly, and it's my killer feature in iTerm. This page on iTerm's wiki explains things in detail: Also, I'd like to open tmux windows as tabs instead of separate iTerm windows, but that's a minor thing. One caveat if you require Mosh for network issues: it and tmux control mode aren't compatible. You can connect to existing tmux session attaching with CC mode and iTerm will open windows and panes to accommodate. I sometimes use iPad or iPhone with Blink.app to connect to my always running sessions. In addition you tmux gives you shell sharing and allows using different devices alltogether. Mac might crash or SSH get disconnected and tmux stays running to save you from losing anything (well, if it's running on a server.). iTerm translates regular commands like new window and split pane into tmux commands and acts otherwise like regular iTerm. ![]() Short version: iTerm with tmux control mode (tmux -CC flag) is still iTerm, only now with tmux benefits like persistent shell sessions. Not at all, if only to tell about virtues iTerm2 and tmux to wider audience! ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |