My rstudio shell preferences are set to custom by launching /usr/bin/local/zsh. My thinking is that RStudio gets its environment variables from there. Since these env vars wouldn't be available in a bash shell.
When running Sys.getenv() from a shell, I get (only showing R vars):
My rstudio shell preferences are set to custom by launching /usr/bin/local/zsh
Does that mean you configured a custom shell under the terminal options, e.g.:
The setting in the Terminal tab does not impact how RStudio loads its R session, only how terminals in the Terminal tab get launched, so it is expected that what you describe would not cause the RStudio session to respect what is in .zshenv.
I'll leave this open at the moment so others more familiar with the overall R startup sequence than I am can comment.
it would make sense for user set variables to be recognized in Rstudio.
RStudio is not started from a shell, so it won't get any shell variables. This is intentional because inheriting shell variables is difficult to do predictably, and it is not common practice (or best) practice for macOS applications to inherit shell variables when started from the Dock.
You could do one of the following:
Actually launch RStudio from the shell that has the environment you want. Run open -a RStudio in a shell.
System details
Steps to reproduce the problem
Sys.getenv()Sys.getenv()Describe the problem in detail
I have the following variables set in my
.zshenvfile:My
~/.config/R/Renvironlooks like:My
~/.config/R/Rprofilelooks like:My rstudio shell preferences are set to
customby launching/usr/bin/local/zsh. My thinking is that RStudio gets its environment variables from there. Since these env vars wouldn't be available in a bash shell.When running
Sys.getenv()from a shell, I get (only showing R vars):When running inside RStudio R console, I get:
Describe the behavior you expected
I expected them to have the same
USERvariables.The text was updated successfully, but these errors were encountered: