Dr Nick Engerer
Dr Nick Engerer

Reputation: 785

Error Installing R Packages from Source in Mac OSX - "make" command not found

I am having an issue with R that I cannot seem to figure out how to fix.

When trying to install an R package from source, I am running into the following error:

* installing *source* package ‘cthresh’ ...
** libs
*** arch - i386
sh: make: command not found
ERROR: compilation failed for package ‘cthresh’
* removing ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/cthresh’

Which would lead you to think that I do not have a compiler installed or that that $PATH is not set. Neither is true. I have installed XCode and echo $PATH gives me:

echo $PATH
/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/admn/bin:/usr/local/bin:/Users/admn/bin:/usr/local/bin:/Users/admn/bin:/usr/local/bin:/Developer-3.2.5/usr/bin:/Users/admn/bin:/usr/local/bin:/Developer-3.2.5/usr/bin

So you can see that Developer shows up in /usr/bin

I have even made sure by:

export PATH=${PATH}:/Developer-3.2.5/usr/bin

If I call 'make' in bash or sh:

sh-3.2$ make make: * No targets specified and no makefile found. Stop.

bash-3.2$ make make: * No targets specified and no makefile found. Stop.

The compilers are there:

bash-3.2$ gcc i686-apple-darwin10-gcc-4.2.1: no input files

bash-3.2$ g++ i686-apple-darwin10-g++-4.2.1: no input files

So what gives? Why is R not able to 'make'? I'm really at a loss on this one and can't seem to find the answer anywhere! My guess is that R is not looking for the right compiler or something, but I can't figure out how to check where it is looking and why it fails on 'make'

I am on a MacBook Pro in OSX Lion. Please help!

---EDIT----

Ok I've made some headway on this problem. Even though I had added

PATH=${PATH}:/Developer-3.2.5/usr/bin

to my bash/sh .profile I needed to add it to the .Renviron file as well. I found that file in: /Library/Frameworks/R.framework/Versions/2.15/Resources/etc/

But now I'm getting this error:

  • installing source package ‘cthresh’ ... ** libs * arch - i386 make: * No rule to make target ._cthreb.o', needed bycthresh.so'. Stop. ERROR: compilation failed for package ‘cthresh’

This makes me think there may be additional things to add to this .Renviron file? Any ideas on what?

Upvotes: 2

Views: 3735

Answers (1)

gok
gok

Reputation: 1157

You need to install "Command Line Tools" from preferences in Xcode 4 for Lion. Otherwise gcc is not available by just installing Xcode in Lion.

Upvotes: 8

Related Questions