WSL Tmux Extra Pane cannot open Code and Window Native Command — Command not Found
Apr 28, 2024
Problem
The command that link to Window binary e.g.,
code
of VS codeexplorer.exe
file explorer
is not found in WSL on Tmux extra pane
But work fine in the main terminal
zsh: command not found: code
Root Cause
The PATH
is automatically injected into the main Teminal.
But not inherit in the Tmux pane.
You can check it easily by compare output of this command in main pane and Tmux pane.
echo $PATH
Solution
Adding this line to .zshrc
Anything that is missing on your Tmux pane by comparing the output of above command.
export PATH=$PATH:/mnt/c/Windows/system32
export PATH=$PATH:/mnt/c/Windows
export PATH=$PATH:/mnt/c/Windows/System32/Wbem
export PATH=$PATH:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/
export PATH=$PATH:/mnt/c/Windows/System32/OpenSSH/
export PATH=$PATH:"/mnt/c/Program Files/Docker/Docker/resources/bin"
export PATH=$PATH:/mnt/c/Users/username/AppData/Local/Microsoft/WindowsApps
export PATH=$PATH:"/mnt/c/Users/username/AppData/Local/Programs/Microsoft VS Code/bin"
Then reopen the Tmux pane.