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 Answers3

5

The correct file to use is ~/.xsessionrc.

Just create that file and enter:

PATH=~/.local/bin:$PATH:~/.cabal/bin
export PATH
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
Gilles Quénot
  • 4,226
  • 1
  • 27
  • 28
  • 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`)? – lmat - Reinstate Monica Feb 25 '22 at 16:14
  • https://unix.stackexchange.com/questions/281858/difference-between-xinitrc-xsession-and-xsessionrc Contain a bit more details, but essentially, it seems like `xinitrc` is the most "portable" choice, but either solution should work. – Xaldew Mar 10 '22 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.

devilcius
  • 101
  • 2