Eric J Ma's Website

Configure tmux and zsh to play nicely

written by Eric J. Ma on 2021-02-28 | tags: shell programming


I have been encountering this problem where tmux reloads my PATH environment variable incorrectly. As it turns out, the fix is documented in a StackOverflow post.

The crux of the problem is as follows: When tmux loads, my .zshrc is re-evaluated. By setting the following line in my .tmux.conf configuration file:

set -g default-command /bin/zsh

I can now prevent zsh from being instantiated as a login shell.

(If you're now wondering what in the world is a "login shell", fret not, I had to search online too. Here's the best answer I found, this time on StackExchange.)


Cite this blog post:
@article{
    ericmjl-2021-configure-nicely,
    author = {Eric J. Ma},
    title = {Configure tmux and zsh to play nicely},
    year = {2021},
    month = {02},
    day = {28},
    howpublished = {\url{https://ericmjl.github.io}},
    journal = {Eric J. Ma's Blog},
    url = {https://ericmjl.github.io/blog/2021/2/28/configure-tmux-and-zsh-to-play-nicely},
}
  

I send out a newsletter with tips and tools for data scientists. Come check it out at Substack.

If you would like to sponsor the coffee that goes into making my posts, please consider GitHub Sponsors!

Finally, I do free 30-minute GenAI strategy calls for teams that are looking to leverage GenAI for maximum impact. Consider booking a call on Calendly if you're interested!