Get "PHP 8 in a Nuthshell" (Now with PHP 8.4)
Amit Merchant

Amit Merchant

A blog on PHP, JavaScript, and more

How to set user paths in Fish Shell

I was installing this Composer package called ibis which is a PHP tool that helps you write eBooks in markdown. Now, the package should be installed globally, so I ran the following command.

$ composer global require themsaid/ibis

To check whether the package is installed or not, I ran the following command.

$ ibis --help

But, I got the following error.

fish: Command 'ibis' not found

I was like, what the hell? I just installed the package globally. So, it should be available in the shell right away!

I checked the ~/.config/composer/vendor/bin directory and found that the ibis executable was there.

I did some digging and found out that the ~/.config/composer/vendor/bin directory was not in my Fish Shell’s fish_user_paths variable. And because of that, Fish Shell was not able to find the ibis executable.

I’m using Ubuntu 22.04 for your reference.

Setting user paths in Fish Shell

To fix this, I ran the following command.

$ set -U fish_user_paths $fish_user_paths $HOME/.config/composer/vendor/bin

This will add the ~/.config/composer/vendor/bin directory to the fish_user_paths variable. And because of that, Fish Shell will be able to find the ibis executable.

You can replace the ~/.config/composer/vendor/bin directory with any other directory that you want to add to the fish_user_paths variable.

The manual way

Alternatively, you can manually add the following line to your ~/.config/fish/config.fish file.

set -U fish_user_paths $HOME/.config/composer/vendor/bin

Save the file and restart your terminal. Now, your Fish Shell will be able to find any executable installed globally via Composer.

Like this article?

Buy me a coffee

👋 Hi there! I'm Amit. I write articles about all things web development. You can become a sponsor on my blog to help me continue my writing journey and get your brand in front of thousands of eyes.

Comments?