3

I've been using terminator, and recently started using fish. When terminator starts (bash) I can use, for example, node just fine. If I then start fish I can still run node just fine.

I set terminator to "Run a custom command instead of my shell", in this case fish, but then I can no longer just run node. Terminal says it is not installed. I kinda can see what the problem is... If I run fish from bash everything just works... It makes sense, I am guessing...

How can I start fish automatically but have the bash stuff working already?

(It's clear I'm not sure what I'm talking about and that is perhaps why I could not find a solution via google...)

  • 2
    I'm not a node expert but I suppose node installation put some variables or is sourcing some settings in your bash files. So after loading bash you have your environment correctly set. Look into ~/.bashrc and/or ~/.bash_profile for some node configuration. If I am right, you will need to put such settings in fish configs (I don't know them). – Kalavan May 12 '17 at 14:13
3

Given your description of the symptoms, you've evidently installed node in a location which is not on your system's default command search path. There's nothing wrong with that, you just need to add that location to the PATH environment variable. That's what you did wrong: you did that in the wrong file.

Unfortunately, a lot of tutorials tell you to set PATH in .bashrc. This is wrong, as you've noticed: if you do that then the setting is only available if you start programs via an interactive instance of bash. Generally speaking, don't set environment variables in .bashrc. Instead, set environment variables in a file that is loaded as part of your session startup when you log in, such as ~/.profile. See Is there a ".bashrc" equivalent file read by all shells? and How to permanently set environmental variables

So the solution is to remove the PATH changes that you've added to ~/.bashrc (either manually or by running some installation script) and put those lines in ~/.profile instead.

To make the changes take effect in your current session, you need to change the environment in your window manager. This will affect any future terminal started from the window manager (there's no way to affect existing terminals). How to do that depends on the window manager.

0

I'm not sure why you are starting bash then starting fish. If fish is the shell you want to use then why not have it set as your default shell "chsh -s /usr/local/bin/fish" then on the rare occasions you want/need to run a bash command you simply type "bash" which drops you into a bash shell then once you finish you type "exit" to go back to fish.

More on this can be found at "https://github.com/fish-shell/fish-shell#switching-to-fish"

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.