I am trying to add environment path variable of composer globally. I've tried many ways but it does not seem to work. I searched other posts, but did not find matching answers.

I am trying to configure laravel 5+ but I need to add the composer path globally in order to access "laravel" syntax using a terminal.

A temporary path set using Terminal works, but permanent path set does not. How do I do this?


You can change the settings in /etc/environment which contains a definiton of the $PATH variable, or add an entry to the system-wide bashrc ( /etc/bash.bashrc which is not as universal as changing the environment setting (i.e. only for bash and if the system-wide bashrc is actually loaded).

  • /etc/environment, yes. /etc/bash.bashrc, no that would only set the variable in interactive shells, not elsewhere (applications started from a menu, cron jobs, etc.). Never set environment variables in .bashrc, only interactive shell settings. Jul 16 '15 at 22:19
  • @Gilles, Do I have to reboot the Ubuntu 16.04 desktop computer after adding an environment variable key-value combination to /etc/environment? Thank you very much.
    – Frank
    Jul 25 '16 at 13:58
  • @Frank The easiest way is to log out and back in. Jul 25 '16 at 14:08
  • @Gilles. Thank you for your great answer to my question. Could I also export MONO_WINFORMS_XIM_STYLE=disabled using /etc/environment so that any programs which run from either the terminal monodevlelop,doubleclick take this environment variable ?
    – Frank
    Jul 25 '16 at 14:42
  • @Frank Sure, you can put any environment variable there. Remember that the syntax is just MONO_WINFORMS_XIM_STYLE=disabled, no export, this isn't a shell script. Jul 25 '16 at 16:41

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.