A good fraction of R users use Apple computers. Apple machines historically have sat at a sweet spot of convenience, power, and utility:
- Convenience: Apple machines are available at retail stores, come with purchasable support, and can run a lot of common commercial software.
- Power:
R
packages such asparallel
andRcpp
work better on top of a Posix environment. - Utility: OSX was good at interoperating with the Linux your big data systems are likely running on, and some R packages expect a native operating system supporting a Posix environment (which historically has not been a Microsoft Windows, strength despite claims to the contrary).
Frankly the trade-off is changing:
- Apple is neglecting its computer hardware and operating system in favor of phones and watches. And (for claimed license prejudice reasons) the lauded OSX/macOS “Unix userland” is woefully out of date (try “
bash --version
” in an Apple Terminal; it is about 10 years out of date!). - Microsoft Windows Unix support is improving (
Windows 10
bash is interesting, though R really can’t take advantage of that yet). - Linux hardware support is improving (though not fully there for laptops, modern trackpads, touch screens, or even some wireless networking).
Our current R platform remains Apple macOS. But our next purchase is likely a Linux laptop with the addition of a legal copy of Windows inside a virtual machine (for commercial software not available on Linux). It has been a while since Apple last “sparked joy” around here, and if Linux works out we may have a few Apple machines sitting on the curb with paper bags over their heads (Marie Kondo’s advice for humanely disposing of excess inanimate objects that “see”, such as unloved stuffed animals with eyes and laptops with cameras).
That being said: how does one update an existing Apple machine to macOS Sierra and then restore enough functionality to resume working? Please read on for my notes on the process.
- Why to upgrade:
I won’t really go too deeply into why one would want to update to macOS Sierra. My reasons were vain hopes the “OSX spinny” would go away, and having to interoperate with Keynote users themselves running macOS Sierra (which has a different version of Keynote). I haven’t really noticed that many differences (I think Grab can now export PNG, the volume control can now send system sound to networked devices), and the upgrade was fairly painless. As expected the upgrade broke a lot of software I use to actually work. This is why I upgrade a scratch machine first. Searching around on the web I think I found enough fixes to restore functionality.
- Why to not upgrade (or why to wait):
Cran seems to still build and test packages for
OSX Mavericks
, so moving tomacOS Sierra
puts you further out of sync with the primary R repository. Also Homebrew (a source of non-decade out of date Posix/Unix software) is likely still catching up tomacOS Sierra
.
Below is our list of issues and work-arounds found in upgrading.
ssh
breaks.ssh
is needed to log in to remote systems and to share Git source control data securely requires a user password each and every time use use it after the upgrade, even if you have put the control password in OSX’s keychain. The fix is to add a file called “config
” to your “~/.ssh
” directory with the following contents. Then after you unlock yourssh
credential once (oddly enough by using thessh
password, not the keychain password) it should remain available to the operating system.Host * UseKeychain yes AddKeysToAgent yes IdentityFile ~/.ssh/id_rsa
To add insult to injury the above config is not compatible with OS X El Capitan, so there is no config that works both before and after an operating system upgrade. Also, I have no good documentation on these features, I presume it is the “
UseKeychain
” argument doing all the work.Java
breaks.A current
Java
is needed for someR
packages (such asrJava
andrSymPy
). FixingJava
seems to take some combination of all of the steps cobbled together from here and here. You re-install Java 8 from Oracle. And then:# Fix Java Home in .profile or .bashrc, in my case add the line export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/ # symlink a Java dynamic library, as some software looks the wrong place sudo ln -f -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib # Try to convince R where Java is sudo R CMD javareconf # Inside R re-install the rJava package install.packages("rJava",type='source')
After that you may also want to fix “legacy Java 6” (it turns out I need it for my XML editor OxygenAuthor). That is just a matter of downloading and installing from https://support.apple.com/kb/dl1572 (despite it claiming not to be for Sierra).
- Homebrew breaks.
Homebrew is one of the currently available ways to get somewhat up to date Unix/Posix software on a Mac. I think Homebrew is not yet officially supporting
macOS Sierra
, but some combination of the following seemed to bring it back (thesudo
commands were all suggested by “brew doctor
“, run at your own risk).brew doctor sudo chown -R $(whoami):admin /usr/local brew update sudo chown root:wheel /usr/local
The above seemed to be enough to get back in the game. I would suggest re-installing and testing complicated software environments such as VirtualBox, docker and Anaconda before upgrading too many machines.
Categories: Opinion Public Service Article Tutorials
jmount
Data Scientist and trainer at Win Vector LLC. One of the authors of Practical Data Science with R.
> sitting on the curb with paper bags over their heads
you people are sick.
After 15 years of running powerbooks & macbook pros, I’ve been thoroughly disappointed with OSX over that last ~18 months. The new hardware is even more disappointing. I jumped ship in December, switching to a ThinkPad with Ubuntu + Win10 dual boot.
Apple was cool in the past. Now is going to go down. Have you seen last Macbook pro?
I think of it this way. Imagine if the new Macbook Pro had a monochrome screen and a color touch bar. It would be obvious that the lack of color on the primary screen is not really mitigated by having color on the touch bar. In fact it is obvious that not having touch on the primary screen also is not mitigated by having touch on the touch bar. Or: a small strip on the bottom of a touch screen can emulate a touch strip, but a touch strip can not emulate a touch screen; therefore a touch screen dominates a touch strip.
Also, at the last conference I attended several of the Macbook Pros could not activate the presentation projector. I presume the chain of dongles (USB-C to wrong format connector, to second adapter, and then to projector) failed to propagate the necessary “I’m awake change modes” handshakes.
I completely agree. I used to use Mac and just 2 months ago I decided to change to Ubuntu. I went with a Dell XPS 13 Developer Edition (works great out-of-the-box with Ubuntu). Different from others, I never 100% loved Mac so was waiting for a good time to switch. I thought I would have lots of trouble using Ubuntu but I find 16.04 surprisingly smooth and easy to use. So far I haven’t run into any problems. I don’t even know how to use the command line. R Studio + Ubuntu is a great combo.
After using Macs since 2001, I finally threw in the towel and bought an HP laptop running Windows 10. R works like a charm.
As the solo contrarian (so far), I’ve upgraded 3 Macs and have a new 2016 MBPro 13″. I had no real issues and did contemplate a Dell 13″ XPS dev vs the 2016 MBPro. I went with a Mac since I need access to apps not in the Ubuntu ecosystem and also to say in the Mac world to influence it. It’s too easy to abandon tech you are having issues with and doing so just helps encourage the demise. I also deploy R on Debian and Ubuntu and teach in a college that has students on Windows. The Windows and Linux users — in my experience — have the worst time with everything, including R. Sent respectful (hard to come by these days) feedback to Apple and encourage them to continue to support the dev-savvy community. Abandoning is the easy way out.
Very good post. I definitely respect your opinion. I feel the same way about Trump and leaving the U.S. As for Mac, I think it is partly because I never liked it in the first place. I really disagree with Apple’s obsession with absolute control. But since I really liked the hardware I put my philosophical objection aside. Now that I think other hardware is better, and I’ve been delightfully surprised by how user-friendly Ubuntu is, it was an easy decision. I know it sounds silly, but I really feel “free” and happy now that I am not using Apple OS. But I really do understand your arguments and I do hope that Apple gets better. They had been innovative for many years and this pushed all other hardware and OS to be better. Thank you for sending your feedback to Apple and for trying to help them get better. That is better for all of us! Kind regards, Xu.
Both very interesting perspectives. Also I feel it was completely appropriate to mention President Trump in the above comment, as he has spoken on Apple. That being said just a heads up: I will not be approving political comments (in either direction) about President Trump as they are off-topic and would quickly overwhelm this tiny forum.
Linux has been my primary platform since switching from SunOS/Solaris many years ago. However, I have been using a MacBook Pro as my travel and “OS diversity” machine for about six years. While I am still troubled by the “complex” copy / paste methods of MacOS, most of my applications work the same on Linux and MacOS thanks to XQuartz and MacPorts. I recently upgraded my primary MacBook directly from Yosemite to Sierra and the only issue was that I had to delete and re-build all of the MacPorts packages. I had no ssh issues, but may not have yet hit the Java issue.
Among the benefits of “OS diversity” for me are corporate (VPN, single sign-on), hobby (photography software), and testing open source software. My single Rcpp package so far, libpcapR, works fine on both Linux and MacOS. At some point I may take the plunge and see if I can make it work on Windows 10.
I survived in the corporate world for 32 years touching Windows only occasionally via VMware or Citrix, but the last few years were aided by official corporate support for MacOS.
I will say that I am glad I have a 2015 MacBook Pro, as an Emacs user the lack of a physical escape key would be annoying.
Sharing more (and especially different) experiences is very helpful. Thanks!