Skip to content

[R-pkg-devel] Build Environment for Mac OS Catalina

3 messages · Russell Almond, Simon Urbanek

#
I'm doing my development on an older version of Mac OS, running 
Catalina.  I'm a bit confused as to what the proper development 
environment is because the stuff on https://mac.r-project.org/tools 
seems to be for either more recent or older versions of MacOS.  I also 
seem to have screwed up something in my toolchain (the curious can see 
my question at 
https://stackoverflow.com/questions/71790401/otool-is-referencing-an-old-version-of-libffi 
).

I have a couple of related questions:

1) What is the right set of instructions for setting up the tool chain 
for Mac OS Catalina?

2) I'm currently using the R install from homebrew, but I thought I saw 
something about a different version of R that I should be using.  Is 
that still current advise?

Thanks, Googling the answers to these questions points me at some pages 
that are clearly out of date.
#
Russel,

this is Mac-specific hence more appropriate for R-SIG-Mac, so moving there.

If you are running Catalina then you have Intel Mac so for CRAN R you simply need XCode and that's it (on a clean Mac you can simply run sudo xcode-select --install). There is nothing special - the only exception is if your package contains Fortran code in which case you just install a Fortran compilers from https://mac.r-project.org/tools/gfortran-8.2-Mojave.dmg

However, since you are using Homebrew then things are a lot more complicated. Homebrew toolchains are not compatible with native Mac binaries and they create its own ecosystem which seems to be broken according to your post.

I would recommend deleting /opt/local then check if you have other incompatible libraries in /usr/local. For severe case of misconfiguration best way to remove (or move aside) everything from /usr/local and start from scratch.

Typically the easiest is to install CRAN R as that does not conflict with anything native and it does not require special tools. You can still use Homebrew to install 3rd party libraries that you may need, but make sure you do NOT install any compilers as they tend to wreak havoc on the system with the conflicting libraries. If your dependencies are supported by CRAN then you can fetch them from https://mac.r-project.org/bin/ or you can re-build them yourself using https://github.com/R-macos/recipes

Cheers,
Simon
#
Thanks for your help.  An older version of homebrew had installed a conflicting older version of `otool` in /opt/local/bin.  Updating was not cleaning the old version.  Once I cleaned manually cleaned that out, it seemed to work.  

I posted details on stack exchange for the curious.  https://stackoverflow.com/questions/71790401/otool-is-referencing-an-old-version-of-libffi/71844231#71844231 <https://stackoverflow.com/questions/71790401/otool-is-referencing-an-old-version-of-libffi/71844231#71844231>

So my R package is now compiling!

	?Russell
(I?m not subscribed to R-SIG-Mac, so if somebody who is could forward this answer, that would be good.)