3

I have some programs installed in my ~/.local/bin/ folder and in /etc/profile I've got the following:

if [ "`id -u`" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="~/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:~/.cabal/bin"
fi
export PATH

XFCE4 does not respect this variable, instead having /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games as PATH, so if I open xfce4-terminal I cannot start programs located in ~/.local/bin/. This also goes for emacs if started from XFCE4, so M-x run-shen, for instance, does not work, as shen is not installed system-wide.

This problem does not occur when using startx, so the problem probably is with how XFCE4 is started.

I did grep -R PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games /etc/, but that didn't turn up anything but /etc/login.def.

3 Answers 3

5

The correct file to use is ~/.xsessionrc.

Just create that file and enter:

PATH=~/.local/bin:$PATH:~/.cabal/bin
export PATH
2
  • Doesn't work with XFCE 4.12 on Ubuntu 16.04 running in vncserver. Commented Aug 22, 2018 at 18:34
  • @FlorinAndrei Maybe try the solution provided by Gilles Quenot below? Commented Jan 5, 2019 at 2:13
0

The correct way is this :

cp /etc/xdg/xfce4/xinitrc  ~/.config/xfce4/xinitrc

then edit ~/.config/xfce4/xinitrc to put

export PATH=~/.local/bin:$PATH:~/.cabal/bin
2
  • There are two answers. They both look reasonable. Is this one correct or the other!? Are they both viable alternatives? Does this one replace the other answer (regarding ~/.xsessionrc)? Commented Feb 25, 2022 at 16:14
  • unix.stackexchange.com/questions/281858/… Contain a bit more details, but essentially, it seems like xinitrc is the most "portable" choice, but either solution should work.
    – Xaldew
    Commented Mar 10, 2022 at 20:34
0

If it's running under a vncserver, check PATH variable has not been set in .vnc/xstartup, otherwise it will override the the one set in .profile or /etc/environment.

You must log in to answer this question.

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