updates of installation bear with macOS (Mojave) [R for BE/BA]

posted by yjlee168 Homepage – Kaohsiung, Taiwan, 2019-07-08 10:15 (372 d 09:11 ago) – Posting: # 20377
Views: 12,342

Dear all,

This is to renew my previous post about installation of bear (or my other R packages using RGtk2 package. For Windows OS or Linux users, the previous posts still hold true. Now, the problem occurs with macOS (Mojave). If you upgrade R to current version (v3.6.1), you may need to read this carefully. The key point is the issue of RGtk2 package installation. As default from preinst.r, RGtk2 is installed as type="binary" which is default for install.packages() function. For most of R packages, this should be no problem at all with macOS. Unfortunately, RGtk2 is an exception. So we need to install RGtk2 correctly; otherwise you will get error messages something like   
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RGtk2/libs/RGtk2.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RGtk2/libs/RGtk2.so, 6): Library not loaded: /Library/Frameworks/GTK+.framework/Versions/2.24.X11/Resources/lib/libgtk-x11-2.0.0.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/RGtk2/libs/RGtk2.so
  Reason: image not found

And there will be a popup window to ask if ‘Need GTK+?’ which was a broken link and was unable to install GTK+ (driver). I have tried thousand times and failed to connect. However, if you can get it from it, do not use it. If you try to install RGtk2 from its source with install.packages("RGtk2",type="source"), you will get another error messages "... gtk is not found. gtk 2.8.0 or above is required.' That implies gtk+ installation previously using Homebrew is not recognized by R any more. So the following steps can resolve this problem (tested with bear v2.8.4/R v3.6.1 with macOS (Mojave)).

Please note that x.xx.xx is the version # of the package. Make sure they are correct. Then RGtk2 should be able to be installed successfully. If it is your first time to install bear, please run source("preinst.r") under R console. Then download bear (source or binary) from Sourceforge and install it with a terminal and type R CMD INSTALL bear_x.xx.xx.tar.gz or R CMD INSTALL bear_x.xx.xx.tgz where x.xx.xx is the version # again. Interesting to find out that with macOS, these two commands R CMD INSTALL bear_x.xx.xx.tar.gz and sudo R CMD INSTALL bear_x.xx.xx.tar.gz do the same things. They all install the package to the same directory. That is very different from Windows OS and Linux. If we type .libPaths() under R console, there is only one library path. Let me know if I was wrong about this. I will update preinst.r later and make it to install/build RGtk2 package from source only for macOS. I feel that gtk2 installed from Macports is much more stable than the previous one (gtk+) from Homebrew.

All the best,
-- Yung-jin Lee
bear v2.8.8:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan http://pkpd.kmu.edu.tw/bear
Download link (updated) -> here

Complete thread:

 Admin contact
20,839 posts in 4,359 threads, 1,450 registered users;
online 16 (1 registered, 15 guests [including 5 identified bots]).
Forum time: 19:27 CEST (Europe/Vienna)

[Those] who have an excessive faith in their theories or in their
ideas are not only poorly disposed to make discoveries, but they
also make very poor observations.    Claude Bernard

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz