0

The latest version of xts on CRAN is 0.7-5. But I'd like to try out the blotter package, for which xts >= 0.7.6.17 is required. To get this latest version, I first I downloaded the .tgz file from RForge and tried:

[Downloads]$ R CMD INSTALL xts_0.7-6.17.tgz 
WARNING: ignoring environment value of R_HOME
* installing to library ‘/Library/Frameworks/R.framework/Resources/library’
* installing *binary* package ‘xts’ ...

* DONE (xts)

After launching R console, I typed require(xts) and got this:

> require(xts)
Loading required package: xts
Loading required package: zoo
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
unable to load shared object '/Library/Frameworks/R.framework/Versions/2.12/Resources/library/xts/libs/x86_64/xts.so':
dlopen(/Library/Frameworks/R.framework/Versions/2.12/Resources/library/xts/libs/x86_64/xts.so, 6): Library not loaded: /usr/local/lib/libgfortran.2.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/2.12/Resources/library/xts/libs/x86_64/xts.so
Reason: image not found
In addition: Warning message:
package 'xts' was built under R version 2.12.2 

I reverted to the CRAN version by downloading that file and running this again:

[Downloads]$ R CMD INSTALL xts_0.7-5.tgz 
WARNING: ignoring environment value of R_HOME
* installing to library ‘/Library/Frameworks/R.framework/Resources/library’
* installing *binary* package ‘xts’ ...

* DONE (xts)

Opening R console and typing in require(xts):

> require(xts)
Loading required package: xts
Loading required package: zoo
>

All is well again, except I need to RForge version to get blotter installed.

NOTE: I'm running OS X (10.6.6)

UPDATE: all is NOT well. Now I can't get the CRAN xts version to load properly.

UPDATE #2: I got my old xts back by running install.packages("xts", repo="http://cran.r-project.org"). Actually, I ran it for "quantmod" and "TTR" as well because all manner of mysterious breaking was occurring.

UPDATE #3: Following Dirk's recommendation in comments below, I've attempted to compile from source on OS X and was met with

make: gfortran: No such file or directory

So after installing from the link at http://www.macresearch.org/xcode_gfortran_plugin_update, I'm now faced with a new error complaining about the -arch flag:

gfortran -arch i386   -fPIC  -g -O2 -c period.max.f -o period.max.o
f951: error: unrecognized command line option "-arch"

UPDATE #4: I installed the wrong fortran compiler in UPDATE #3. Don't use that compiler for R packages.

Milktrader
  • 9,278
  • 12
  • 51
  • 69
  • Can you install from **source** rather than binary? Use a `tar.gz`, not the `tgz` for Mac. – Dirk Eddelbuettel Feb 22 '11 at 03:31
  • Also, does this work for you `install.packages("xts", repos="http://R-Forge.R-project.org")` – Gavin Simpson Feb 22 '11 at 10:43
  • @Gavin, this gives the same result as [Downloads]$ R CMD INSTALL xts_0.7-6.17.tgz – Milktrader Feb 22 '11 at 13:56
  • @Dirk, I'm embarrassed to say I cannot find the .tar.gz file. At the RForge xts site, there are links to xtime_0.3.tgz, but installing that from source appears to install xts 0.7-5 – Milktrader Feb 22 '11 at 13:59
  • It is right on the project page: https://r-forge.r-project.org/src/contrib/xts_0.7-6.17.tar.gz – Dirk Eddelbuettel Feb 22 '11 at 14:12
  • @Dirk, thanks. The install from source fails with the message: "make: gfortran: No such file or directory." I'll start googling that error and see why OS X is failing there. Thanks for the lead. – Milktrader Feb 22 '11 at 17:29
  • See the Appendix of the R Inst + Admin manual. You need the gfortran compiler from Apple dev tools or whatever Steve calls that. – Dirk Eddelbuettel Feb 22 '11 at 17:34

1 Answers1

4

If you are using R on the Mac OS X platform, then it's good to know the mechanics of installing from source, as Mac binaries are sometimes slow to make it to repositories. The R eco-system is Ubuntu and SVN. Someday it may morph to OS X and Git (we can hope, no?)

Before you start installing from source, you need to make sure you have Xcode installed.

http://developer.apple.com/technologies/tools/xcode.html

Then you need to have a fortran compiler, which doesn't come with Xcode. The good news is that there is a place devoted to fortran compilers on OS X for R users.

http://r.research.att.com/tools/

Once this is installed and configured properly, you need to get the cutting-edge version of xts from RForge from here: (Thanks Dirk)

http://r-forge.r-project.org/src/contrib/xts_0.7-6.17.tar.gz

Finally, simply run the following from command-line in terminal:

[Downloads]$ R CMD INSTALL xts_0.7-6.17.tar.gz

NOTE: tar.gz is the extension for source files while .tgz is the extension for Mac binaries.

Milktrader
  • 9,278
  • 12
  • 51
  • 69