Set environment variable $PATH globally on Ubuntu 14.04

32,803

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).

Share:
32,803

Related videos on Youtube

DpEN
Author by

DpEN

Updated on September 18, 2022

Comments

  • DpEN
    DpEN over 1 year

    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?

  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 9 years
    /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.
  • mishmish
    mishmish almost 8 years
    @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.
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 8 years
    @Frank The easiest way is to log out and back in.
  • mishmish
    mishmish almost 8 years
    @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 ?
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 8 years
    @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.