I need to use a program called Kpax, the "installation" process consist in this:

(for bash users, edit ~/.bashrc)
   export KPAX_ROOT=/home/dritchie/kpax       <-  substitute the proper pathname here.

   export PATH=${PATH}:${KPAX_ROOT}/bin

I'm using Garuda with fish shell, if I run Kpax using bash works great, the problem is that I need to run Kpax from a php file and every time I use shell_exec() this appear in the error_log:

kpax: command not found

Is there a way to replicate the thing with the environment variables in fish as in bash?

  • 1
    You'll use the set command to create the environment variable (instead of export), and the fish_add_path command May 4, 2021 at 2:09

2 Answers 2


In fish shell 3.2 or later, you can just run:

fish_add_path /home/dritchie/kpax/bin

substituting in your home directory.

You can run this once at the command line, or add it to ~/.config/fish/config.fish; either way it will be remembered. Here's documentation for fish_add_path.

You might still need the KPAX_ROOT environment variable, however, so you might still need to set -U that one.


According to https://fishshell.com/docs/current/cmds/set.html?highlight=environment

You'll need to use the set command to set the variables and explicitly export them.

According to https://fishshell.com/docs/current/tutorial.html?highlight=configuration (search deep in the document for "Startup (where's .bashrc)" the file you need to edit is ~/.config/fish/config.fish)

So putting those two together, add the following to the end of your existing ~/.config/fish/config.fish (or just create a file containing only the following if that doesn't already exist):

set -gx KPAX_ROOT <your path to KPAX installation>
set -gx PATH $PATH "$KPAX_ROOT"/bin

Alternatively, it might be even easier to just create the needed variables as "Universal":

set -U KPAX_ROOT <path to KPAX installation>
set -U PATH $PATH "$KPAX_ROOT"/bin

(You should only have to execute this once and it should update fish for eternity on your behalf according to the documentation).

I don't have and haven't used fish, but hopefully these references to the fish manual and the suggestions I provide will get you where you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.