Nan Xiao, Lei Sun and Peter Carbonetto.
Install Xcode from Mac App Store. Install Xcode Command Line Tools by
xcode-select -p
if you haven't already done so.
Download the most recent version of mosek for Mac from [1], then
extract it to ~/mosek
. Note we want the "MAC OSX 64 bit x86" version
here.
This could be done under GUI, or under terminal. For example:
wget http://download.mosek.com/stable/7.1.0.53/mosektoolsosx64x86.tar.bz2
tar -xvf mosektoolsosx64x86.tar.bz2
Apply for free personal academic license from [2]. Download the .lic
file, and copy it to the mosek folder, for example,
~/mosek/mosek.lic
.
It is very important to know that the next step for installing Rmosek should be done under the terminal, instead of RStudio.
Open your terminal app, then:
R
install.packages("Rmosek", type="source", INSTALL_opts="--no-multiarch",
configure.vars="PKG_MOSEKHOME=~/mosek/7/tools/platform/osx64x86 PKG_MOSEKLIB=mosek64",
repos="http://download.mosek.com/R/7")
Then after about 30 seconds' compilation, if successful, the result output should be something like:
* DONE (Rmosek)
The downloaded source packages are in
'/tmp/Rtmpat8Xg6/downloaded_packages'
Before using Rmosek, it is helpful to check that it works. Here is a small test example from the Rmosek package:
require(Rmosek)
lo1 <- list()
lo1$sense <- "max"
lo1$c <- c(3,1,5,1)
lo1$A <- Matrix(c(3,1,2,0,
2,1,3,1,
0,2,0,3),
nrow=3, byrow=TRUE, sparse=TRUE)
lo1$bc <- rbind(blc = c(30,15,-Inf),
buc = c(30,Inf,25))
lo1$bx <- rbind(blx = c(0,0,0,0),
bux = c(Inf,10,Inf,Inf))
r <- mosek(lo1)
Once you have confirmed that Rmosek is working, you could install
REBayes
and ashr
smoothly:
install.packages('REBayes')
devtools::install_github('stephens999/ashr')
[1] mosek download