Skip to content

Instantly share code, notes, and snippets.

@goddoe
Created March 3, 2020 11:03
Show Gist options
  • Save goddoe/d375f961aef1c555b3425c5d1939af23 to your computer and use it in GitHub Desktop.
Save goddoe/d375f961aef1c555b3425c5d1939af23 to your computer and use it in GitHub Desktop.
How not to screw my path, when using tmux, conda together

If you're on a Mac and have been wondering why /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin keeps getting prepended to PATH when you run tmux, it's because of a utility called path_helper that's run from your /etc/profile file.

You can't easily persuade tmux (or rather, bash) not to source /etc/profile (for some reason tmux always runs as a login shell, which means /etc/profile will be read), but you can make sure that the effects of path_helper don't screw with your PATH.

The trick is to make sure that PATH is empty before path_helper runs. In my ~/.bash_profile file or ~/.zshrc I have this:

if [ -f /etc/profile ]; then
    PATH=""
    source /etc/profile
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment