1

I was following this solution and noticed that it's temporarily working for me. I tried doing

export PATH="$PATH:$HOME/.config/composer/vendor/bin" >> ~/.bashrc

and

export PATH="$PATH:$HOME/.config/composer/vendor/bin" >> ~/.profile

than I did source ~/.bashrc and source ~/.profile to update those files. When I open them in an editor I don't see the new path in either file. However, I'm able to use the laravel command in that instance of terminal where I used those commands, but it doesn't work in any new terminals. How can I make this change to my $PATH permanent?

1 Answer 1

4

>> redirects standard output. The command export PATH="$PATH:$HOME/.config/composer/vendor/bin" doesn't produce any standard output, so nothing gets appended to the file(s).

You probably wanted

echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc

or just

echo 'PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc

since PATH has almost certainly been exported into the environment already.

Also not that the source command does not "update [those] files"; it updates your current shell based on the contents of those files.

2
  • what's the diff between using export PATH and just PATH?
    – Pachuca
    Aug 10, 2021 at 15:52
  • @Pachuca export VAR places VAR (and its value) into the environment of any child processes started by the shell, whereas unexported variables only exist in the current shell environment. In the case of PATH, it's likely already been marked for export early in the session via pam_env and doesn't really need to be exported again. Aug 10, 2021 at 16:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .