title: R error: Library not loaded: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libR.dylib
body: <p>R was working fine until the security app installed by my school run yesterday.   I am having this  issue, <code>Library not loaded:/Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libR.dylib</code> in some but not all packages.</p>
  <p>Here is my R installation;</p>
  <pre><code>/Library/Frameworks/R.framework/Versions ❯ l                                                                                                              02:53:02 PM
  total 0
  drwxrwxr-x  5 root  admin   160B May 20 13:04 .
  drwxrwxr-x  8 root  admin   256B May 20 13:04 ..
  drwxrwxr-x  5 root  admin   160B May 20 13:29 4.1
  drwxrwxr-x  6 root  admin   192B May 20 13:04 4.2
  lrwxr-xr-x  1 root  admin     3B May 20 13:03 Current -&gt; 4.2
  </code></pre>
  <p>There is no lib/ in 4.1/Resources and a current version should be 4.2 but for some reasons, it looks for 4.1.</p>
  <p>Interesting, if I run R from terminal but not Rstudio, everything works fine.</p>
  <p>I'd appreciate any help to restore the libR.dylb path.</p>
  <pre><code>&gt; Sys.getenv('R_HOME')
  [1] &quot;/Library/Frameworks/R.framework/Resources&quot;
  
  &gt; sessionInfo()
  R version 4.2.0 (2022-04-22)
  Platform: x86_64-apple-darwin17.0 (64-bit)
  Running under: macOS Big Sur 11.6.5
  
  Matrix products: default
  LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
  
  locale:
  [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
  
  attached base packages:
  [1] stats4    stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] BiocGenerics_0.43.0
  
  PATH=/usr/local/opt/llvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/CyberArk EPM.app/Contents/Helpers:/Library/Apple/usr/bin
  DISPLAY=/private/tmp/com.apple.launchd.LzOT3qwX1V/org.xquartz:0
  
  neofetch                                                                                                                                              03:09:06 PM
                      'c.          
                   ,xNMM.          ---------------------------
                 .OMMMMo           OS: macOS 11.6.5 20G527 x86_64
                 OMMM0,            Host: Macmini8,1
       .;loddo:' loolloddol;.      Kernel: 20.6.0
     cKMMMMMMMMMMNWMMMMMMMMMM0:    Uptime: 2 hours, 44 mins
   .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Packages: 120 (brew)
   XMMMMMMMMMMMMMMMMMMMMMMMX.      Shell: zsh 5.8
  ;MMMMMMMMMMMMMMMMMMMMMMMM:       Resolution: 1920x1080
  :MMMMMMMMMMMMMMMMMMMMMMMM:       DE: Aqua
  .MMMMMMMMMMMMMMMMMMMMMMMMX.      WM: Quartz Compositor
   kMMMMMMMMMMMMMMMMMMMMMMMMWd.    WM Theme: Blue (Light)
   .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   Terminal: iTerm2
    .XMMMMMMMMMMMMMMMMMMMMMMMMK.   Terminal Font: MesloLGS-NF-Regular 11
      kMMMMMMMMMMMMMMMMMMMMMMd     CPU: Intel i7-8700B (12) @ 3.20GHz
       ;KMMMMMMMWXXWMMMMMMMk.      GPU: Intel UHD Graphics 630
         .cooc,.    .,coo:.        Memory: 36150MiB / 65536MiB
  </code></pre>