title: Installing R packages in macOS Mojave: Error in if (nzchar(SHLIB_LIBADD))
body: <p>I have been trying to install R packages directly from the terminal but I am struggling much more than setting up the libraries I want in Windows. Sometimes it works if I install every single dependency for more complex packages by downloading them from CRAN and placing them in the R folder.
  I appreciate this is not efficient but the recurrent error if I run R within the terminal while installing some of the packages is the following:</p>
  
  <pre><code>** libs
  Error in if (nzchar(SHLIB_LIBADD)) SHLIB_LIBADD else character() : 
  argument is of length zero
  * removing ‘/anaconda3/lib/R/library/&lt;package name&gt;’
  </code></pre>
  
  <p>[...]</p>
  
  <pre><code>In install.packages("&lt;package name&gt;") :
  installation of package ‘fpc’ had non-zero exit status
  </code></pre>
  
  <p>I have been looking across many forums but the only solution I found so far is to install single dependencies manually by downloading them and dropping them in the master R folder. It is taking way longer than expected.
  Any suggestion will be appreciated. Thanks</p>