This is Steph's "living" document with instructions/documentation of my set-up on a MacBook Pro M1 (2020), with a focus on #rstats data science and meta tools π
- Google Chrome
- Mozilla Firefox
- Brave - for M1/Apple Chip
- R - select the Apple silicon arm64 build (I select the O-Cloud Mirror)
- RStudio - requires R 3.0.1 or higher (as of Sept. 2021)
- Miniconda - following UBC MDS Instructions
- Trello - from the Mac App Store
- Docker
- Zoom
- Alfred App
- SublimeText
- Visual Studio Code
- Google Drive for Desktop
- Customize the touchbar - for adding the Lock Screen button for quick access/use
- Customize the Finder toolbar and sidebar
- Show the HD on desktop
- Safari > Preferences > Advanced > Show full website address
- Safari > Preferences > Advanced > Show Develop menu
- Safari > View > Show status bar
- Show dotfiles
- one time: Cmd + Shift +
.
- to show them all the time: (from Terminal)
defaults write com.apple.finder AppleShowAllFiles -bool YES; killall Finder
- to hide them again: (from Terminal)
defaults write com.apple.finder AppleShowAllFiles -bool NO; killall Finder
- one time: Cmd + Shift +
Demo and how to tailor the App in this YouTube video. "Register" the .Rproj file-type with Alfred:
- Go to Alfredβs Preferences > Features > Default Results > Advanced
- Drag any .Rproj file onto this space and then close
Installed homebrew
on a Macbook with M1/Apple Chip https://stackoverflow.com/questions/66666134/how-to-install-homebrew-on-m1-mac, and then immediately implemented this fix when homebrew
bonked installing Git
π³ Homebrew/discussions#501
The biggest M1 difference seems to be setting the PATH to homebrew manually in your Terminal dot file, so putting export PATH=/opt/homebrew/bin:$PATH
in ~.zshrc
.
cd && mkdir Rlibrary
echo R_LIBS=~/Rlibrary >> .Renviron
RStudio >> Tools >> Global Options >> General >> Basic:
- untick
Restore .RData into workspace at startup
Save workspace to .RData on exit: <NEVER>
RStudio >> Tools >> Global Options >> General >> Advanced:
- tick
Show .Last.value in environment listing
RStudio >> Tools >> Global Options >> Terminal
- new terminals open with:
If R or RStudio are opened via the Terminal then the PATH to homebrew will be accessed via the ~.zshrc
file. However, not if opened using the Dock. Add PATH="/opt/homebrew/bin:${PATH}"
to your ~.Renviron
file if you need R/RStudio to access homebrew.
Using LaTeX` distribution from {tinytex} which is built especially for using with R.
In R:
install.packages("tinytex")
tinytex::install_tinytex()
I had to implement this fix in the Terminal (to gain write access to /usr/local/bin
) to install {tinytex} rstudio/tinytex#24.
I also had to implement this fix to get extrafont::font_import()
to work wch/extrafont#88
remove.packages("Rttf2pt1")
remotes::install_version("Rttf2pt1", version = "1.3.8")
Git: Install and Configure Git
brew install git
git config --global user.email firstname.lastname@email.ca
git config --global user.name "Firstname Lastname"
git config --global core.editor "nano"
git config --global credential.helper osxkeychain
GitHub: Set Up GitHub Authorization
- Create a new Personal Access Token with repo, user, and gist access. Copy the key to your clipboard.
- In R:
install.packages("gitcreds")
library(gitcreds)
gitcreds_set()
Set default for Pull, I use the previous Git default (see SO issue with warning message & discussion/options)
git config pull.rebase false
I "vaccinated" my global gitignore with {usethis}'s git_vaccinate()
, details here https://usethis.r-lib.org/reference/git_vaccinate.html
Xquartz is a graphics device for R
brew install xquartz
Split, Combine and Compress PDF files using the {qpdf} R package, installing the C++ source library:
brew install qpdf
To build packages from source (i.e., new releases or development versions from GitHub):
brew install libsvg curl libxml2 boost
## imagemagick for command-line image manipulation and use of the 'magick' R package
brew install imagemagick
## `rmapshaper` R package has a size limit
brew install node
npm install -g mapshaper
Install Visual Studio Code and add in Extensions:
- GitHub Pull Requests & Issues
- Jupyter
- Python, Pylance
- R, R debugger
- Markdown All in One
- Path Autocomplete
Install R packages languageserver
and httpgd
and radian from Terminal pip3 install -U radian
Use Shift-Command-P in VSCode to Open Settings (setting.json
) and/ or Keyboard Shortcuts (keybindings.json
) to edit and personalize.
I use the Miniforge installation for arm64/Apple Silicon/M1. I downloaded the sh
file, ran bash filename.sh
in the Terminal and followed the prompts. I then used the UBC MDS Software stack install instructions for macOS for adding some Python packages using conda install
.