diff --git a/src/cpp/core/r_util/REnvironmentPosix.cpp b/src/cpp/core/r_util/REnvironmentPosix.cpp index a4e964d49d..512707801b 100644 --- a/src/cpp/core/r_util/REnvironmentPosix.cpp +++ b/src/cpp/core/r_util/REnvironmentPosix.cpp @@ -108,13 +108,7 @@ FilePath systemDefaultRScript(std::string* pErrMsg) { // check fallback paths std::vector rScriptPaths = { - "/usr/bin/R", - "/usr/local/bin/R", - "/opt/local/bin/R", - #ifdef __APPLE__ - "/opt/homebrew/bin/R", - "/Library/Frameworks/R.framework/Resources/bin/R", - #endif + "@R@/bin/R" }; return scanForRScript(rScriptPaths, pErrMsg); @@ -226,8 +220,7 @@ FilePath systemDefaultRScript(std::string* pErrMsg) // scan in standard locations as a fallback std::string scanErrMsg; std::vector rScriptPaths; - rScriptPaths.push_back("/usr/local/bin/R"); - rScriptPaths.push_back("/usr/bin/R"); + rScriptPaths.push_back("@R@/bin/R"); FilePath scriptPath = scanForRScript(rScriptPaths, &scanErrMsg); if (scriptPath.isEmpty()) { diff --git a/src/node/desktop/src/main/detect-r.ts b/src/node/desktop/src/main/detect-r.ts index 5b768b7cbf..c0efeac0fe 100644 --- a/src/node/desktop/src/main/detect-r.ts +++ b/src/node/desktop/src/main/detect-r.ts @@ -305,6 +305,7 @@ writeLines(sep = "\x1F", c( } export function scanForR(): Expected { + return ok('@R@/bin/R'); // if the RSTUDIO_WHICH_R environment variable is set, use that // note that this does not pick up variables set in a user's bash profile, for example const rstudioWhichR = getenv('RSTUDIO_WHICH_R');