title: Error ".onLoad failed in loadNamespace() for 'tcltk'"
body: <p>I have a general question about how to effectively load any kind of external package into R. I have found that many sources detailing this information are simply insufficient, but I will leave out mentioning those respective URLs.  I have successfully loaded external packages into R before, but I am having difficulties loading the <code>fgui</code> package.</p>
  
  <p>In my specific case, I cannot load the library <code>fgui</code> into R Studio. First I download directly from CRAN with the command:</p>
  
  <pre><code>install.packages("fgui", lib="~/Documents/R_dir")
  </code></pre>
  
  <p>This works fine for me. My working directory is set to ~/Documents/R_dir</p>
  
  <p>The next command I use is:</p>
  
  <pre><code>library("fgui", lib.loc="~/Documents/R_dir")
  </code></pre>
  
  <p>The error I get is:</p>
  
  <pre><code>Error : .onLoad failed in loadNamespace() for 'tcltk', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so, 10): Library not loaded: /opt/X11/lib/libX11.6.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so
  Reason: image not found
  Error: package or namespace load failed for ‘fgui’
  </code></pre>
  
  <p>I have examined the thread "<a href="https://stackoverflow.com/questions/6066130/error-when-trying-to-load-libraryggplot2-in-r">Error when trying to load library(ggplot2) in R</a>" but it did not answer my question. </p>
  
  <p>Please help me with any suggestions to get the package <code>fgui</code> to work properly in R Studio and feel free to address the more general issue of effectively loading external packages into R.  </p>