Can you provide the exact output of capabitilies() in each environment (terminal R vs. R in RStudio) just so we know what you're seeing?
Can you also post the code you're running and the exact error message you're seeing, just so we understand what exactly the error is?
You can also try running this command from the terminal to see what flags were passed to R on configure:
R -e "writeLines(head(readLines(R.home('etc/Makeconf')), n = 8))"
As an example, I have (splitting each argument by line for readability)
'--prefix=/usr'
'--with-cairo'
'--with-jpeglib'
'--with-readline'
'--with-tcltk'
'--with-system-bzlib'
'--with-system-pcre'
'--with-system-zlib'
'--mandir=/usr/share/man'
'--infodir=/usr/share/info'
'--datadir=/usr/share/R/share'
'--includedir=/usr/share/R/include'
'--with-blas'
'--with-lapack'
'--enable-R-profiling'
'--enable-R-shlib'
'--enable-memory-profiling'
'--without-recommended-packages'
<...>