pixi icon indicating copy to clipboard operation
pixi copied to clipboard

feat(shell): support for Fish on Windows

Open fstanis opened this issue 2 months ago • 1 comments

This PR fixes #4648.

Currently, on Windows (via #3981) we launch bash by creating a new bash process with --init-file which contains all the environment variables, completions and custom prompt.

This doesn't work for other shells unfortunately since --init-file is bash-specific. This PR splits the init file into two parts: one for the environment variables (called init_file in code), which uses bash syntax, and the other one for completions and custom prompt, which is specific to the shell that's starting (called env_file in code).

pixi shell therefore first starts bash in a new process with the init_file, then one of two things happens:

  • If we're using fish, we use exec for fish to "take over" the bash process, sourcing env_file in the process.
  • If we're using bash, we simply source the file with env_file.

This logic should be possible to reuse for xonsh and zsh as well, although someone more knowledgeable would need to clarify how to best perform the "take over" step for those shells.

fstanis avatar Oct 16 '25 15:10 fstanis

Hey @ruben-arts / @baszalmstra, just a friendly ping since it's been a few weeks, would appreciate your input if you're happy we proceed with this approach

fstanis avatar Nov 06 '25 11:11 fstanis

Im trying to test your changes but Im having a hard time installing fish. Could you maybe help me out? I have git bash, but how can I get fish in there as well?

baszalmstra avatar Dec 05 '25 14:12 baszalmstra

Sure - you need to install pacman first if you're using Git for Windows, I use the script here: https://github.com/alexsarmiento/gitportable-pacman/blob/master/install-pacman-git-bash.sh

After that, pacman -S fish works. Alternatively, if you installed MSYS2 from their website, it comes with pacman already.

fstanis avatar Dec 16 '25 18:12 fstanis