0

After using migration assistant to move from my MacBook Pro 2018 I5 to the new MacBook Pro 2020 M1, I tried to run R at the command line simply with R and got the errors:

/usr/local/bin/R: line 271: /usr/local/Cellar/r/4.0.3/lib/R/bin/exec/R: Bad CPU type in executable
/usr/local/bin/R: line 271: /usr/local/Cellar/r/4.0.3/lib/R/bin/exec/R: Undefined error: 0

I tried:

sudo rm -rf /Applications/R.app
sudo rm -rf /Library/Frameworks/R.framework
sudo rm /usr/bin/{R,Rscript}
sudo rm -rf /usr/local/bin/R

and successfully removed R, showing:

zsh: command not found: R

I then tried to reinstall R with homebrew, but got errors such as:

Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
Please create a new installation in /opt/homebrew using one of the
"Alternative Installs" from:
  https://docs.brew.sh/Installation
You can migrate your previously installed formula list with:
  brew bundle dump
Error: Git must be installed and in your PATH!
Error: homebrew/science was deprecated. This tap is now empty and all its contents were either deleted or migrated.
Phil
  • 7,287
  • 3
  • 36
  • 66
kana
  • 605
  • 7
  • 12

1 Answers1

0

I realized this was probably a git and/or homebrew problem, so I used instructions from the homebrew site indicated in the error in the prescribed directory with sudo mkdir homebrew && sudo curl -L https://github.com/Homebrew/brew/tarball/master | sudo tar xz --strip 1 -C homebrew and got the same errors. At this point I updated my Mac OS, to 11.2.2., and found this great walkthrough. This solved all my problems and I was able to upgrade my git, install xquartz, R, and Rstudio with brew:

/usr/sbin/softwareupdate --install-rosetta --agree-to-license
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
arch -x86_64 brew install git
arch -x86_64 brew upgrade git
arch -x86_64 brew install Caskroom/cask/xquartz
arch -x86_64 brew install --cask r
arch -x86_64 brew install --cask rstudio

This is a combination of snips from here and the previous walkthrough.

kana
  • 605
  • 7
  • 12