0

I'm running Mac OS X 10.7.5 (Lion), which means that the latest version of R I can run is 3.2.1. Since binaries of packages are no longer being made for this version, it means that I need to install the latest package versions from source. I can do this with

install.packages(pkgs, type = "source")

I installed GNU Fortran, although it's not clear to me whether I need it or not in order to compile R packages.

When I try to compile packages from source in R, however, I get error messages indicating that I don't have (or that R cannot find) the necessary compiling tools. Cf. e.g.:

* installing *source* package ‘scales’ ...
** package ‘scales’ successfully unpacked and MD5 sums checked
** libs
sh: make: command not found
ERROR: compilation failed for package ‘scales’

and

* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
checking for local ICUDT_DIR... icu55/data
checking for R_HOME... /Library/Frameworks/R.framework/Resources
checking for R... /Library/Frameworks/R.framework/Resources/bin/R
checking for R >= 3.1.0 for C++11 use... yes
checking for R < 3.4.0 for CXX1X flag use... yes
checking for cat... /bin/cat
/Library/Frameworks/R.framework/Resources/bin/config: line 150: make: command not found

[...]

checking for gcc... no
checking for cc... no
checking for cl.exe... no
/Library/Frameworks/R.framework/Resources/bin/config: line 153: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 269: make: command not found
configure: error: in `/private/var/folders/2r/6c5vhb4s3zx3zs4d1dbf9p940000gn/T/Rtmpob4pMm/R.INSTALLd4676ad8595/stringi':
configure: error: no acceptable C compiler found in $PATH

I assume what's needed is to install the necessary compiling tools for R packages. What do I need to do?

(If I need to provide additional information, just ask for it in a comment, and I will provide it)

Sverre
  • 747
  • 2
  • 8
  • 19
  • Have you tried installing Xcode and its utilities. I think the Xcode utilities has c compilers etc., but it doesn't install by default when you install Xcode. I don't have a Mac anymore and things may have changed since. – kangaroo_cliff Jul 09 '17 at 02:09
  • @DiscoSuperfly If what I need isn't installed by default when I install Xcode, I probably wouldn't know what to do. – Sverre Jul 09 '17 at 02:23
  • I think what you need to google is "install Xcode command line tools" – kangaroo_cliff Jul 09 '17 at 02:31
  • Lion was EOL from general support and security patches as of December 14, 2015. Do you own hardware that can't be upgraded? If so, consider switching to some Linux distribution. – hrbrmstr Jul 09 '17 at 02:35
  • @hrbrmstr My Macbook is "early 2008", so no, Lion is as far as I can go with it. Installing another OS seems to be an extreme solution to a small problem (which is to install or let R find a compiler). – Sverre Jul 09 '17 at 02:37
  • 1
    You have much larger problems than the R setup. You're a prime target for malicious takeover and then a likely source of other malicious activity on the internet. I grok that you probably can't just go out and buy a new system, but you're putting yourself seriously in harm's way with that setup. I hope you're at least running some supported anti-malware program and have a good host firewall setup & aren't using Safari. – hrbrmstr Jul 09 '17 at 15:08

1 Answers1

1

It might be tricky. First of all, double check whether you can download XCode from AppStore or not. If you can, you will be able to install command line tools as well. Either via Preferences -> Downloads (as far as I recall), or they will be installed during first startup.

Alternatively, create free account here:

http://developer.apple.com

Then, head to:

https://developer.apple.com/download/more/

and find XCode. It might be you will need to install some really old version.

As @hrbrmstr mentioned, it might be that installing virtual machine (e.g. inside VirtualBox) with Linux will be less painful.

Note that you will probably encounter more and more issues while installing packages. There is no easy way if you are forced to stick with old OS X :(

Update:

As @Sverre pointed out, it would be better to have a complete list of links here:

XCode - (Lion version) download from Apple (not to confuse with AppStore)

Command Line Tools - (Lion version) you can install them separately, without installing XCode

Oo.oO
  • 12,464
  • 3
  • 23
  • 45
  • I can download XCode from AppStore, but it says it requires Mac OS X 10.12 or later. – Sverre Jul 09 '17 at 03:32
  • You can try to install this one: http://adcdownload.apple.com/Developer_Tools/command_line_tools_os_x_lion_for_xcode__april_2013/xcode462_cltools_10_76938260a.dmg - but I think you will need account. It's free. – Oo.oO Jul 09 '17 at 03:51
  • If you could include your comment here into your answer, it would be more complete. Installing the linked version of XCode solved my problem. – Sverre Jul 09 '17 at 19:43