Sample Header Ad - 728x90

Why RStudio is not picking up environment variables defined in $HOME/.bashrc

0 votes
2 answers
698 views
I use Arch Linux. I use SSDM as display manager, but I have disabled it with:
sudo systemctl disable sddm
I have put code in /etc/profile, $HOME/.bash_profile and $HOME/.bashrc to echo when those files are sourced. My $HOME/.bash_profile is sourcing $HOME/.bashrc (it came like that, I just added the code to echo when this happens):
if [[ -f ~/.bashrc ]]; then
	echo "$HOME/.bash_profile is sourcing $HOME/.bashrc"
	. ~/.bashrc
fi
I am exporting the following variable in my $HOME/.bashrc:
export R_LIBS_USER='MY_VALUE'
---- I boot my PC. It shows a prompt (in a TUI/command line) that asks for username and then password. I put them in and press enter. /etc/profile is source. $HOME/.bash_profile is source. The latter sources $HOME/.bashrc. This means that R_LIBS_USER is being exported. I'm redirected to a prompt. I do:
sudo systemctl start ssdm
Since SSDM is a child of that shell, it should inherit R_LIBS_USER. SSDM opens and I start a Wayland KDE session. Since this session is a child of SSDM, it should inherit R_LIBS_USER. I open RStudio from KDE. But R_LIBS_USER is still at the default value, not the one I have defined in $HOME/.bashrc. I show the value of the variable in R with:
Sys.getenv("R_LIBS_USER")
Where is my reasoning failing?
Asked by robertspierre (379 rep)
Jun 16, 2023, 04:22 PM
Last activity: May 5, 2025, 08:30 AM