5.1 SetUp

Information about set up:

xfun::session_info(c("bookdown", "knitr", "rmarkdown", "xfun"),
    dependencies = FALSE)
## R version 4.5.0 (2025-04-11)
## Platform: aarch64-apple-darwin20
## Running under: macOS Sequoia 15.5
## 
## Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8
## 
## Package version:
##   bookdown_0.43  knitr_1.50     rmarkdown_2.29 xfun_0.52     
## 
## Pandoc version: 3.6.4

How to setup VSCode

About my system. This is what I’m using and how I set up my system. The average user I believe will need 24 GB of memory and a CPU greater than an intel i7 with 8+ cores for GPU and CPU. Storage is more of a preference as cloud storage is always available for purchase. For machine learning, it is recommended to have NVIDIA GPU. If you don’t have one, Google Colab is an alternative platform to these limits.

  • MacBook Pro
  • 48 GB
  • 14-core CPU
  • 20-core GPU

I run R in VSCode

Check for home updates and update if needed.

Install Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Update Homebrew

brew update
brew doctor

updated command line tools

sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

Install mamba from the miniforge relseases and downloaded the latest arm64.sh

cd ~/Downloads
chmod +x Miniforge3-24.11.3-2-MacOSX-arm64
./Miniforge3-24.11.3-2-MacOSX-arm64
conda install mamba -n base -c conda-forge
mamba shell init -s zsh -p ~/miniforge3

export MAMBA_ROOT_PREFIX="$HOME/miniforge3"
export PATH="$HOME/miniforge3/bin:$PATH"
source ~/.zshrc


which mamba
mamba --version

Python

mamba install python=3.11
python --version

Git

brew install git
git --version

VSCode

brew install --cask visual-studio-code
rm -rf /Applications/Visual\ Studio\ Code.app

R and RStudio

brew install --cask r
R --version

brew install --cask rstudio
brew install --cask visual-studio-code

pipx

mamba install pipx -c conda-forge

pipx ensurepath
source ~/.zshrc

pipx --version
pipx install radian
export PATH="$HOME/.local/bin:$PATH"
source ~/.zshrc

verify if it works

which radian
file $(which radian)

install R extensions on VSCode and these packages

install.packages(c("languageserver", "httpgd", "tidyverse", "data.table",
    "jsonlite", "rmarkdown"))

Weird behaviors:

mabma would return a weird wrapper when called:

mamba () {
    __mamba_wrap "$@"
}

to fix this I replaced the set up in .zshrc:

# >>> mamba initialize >>>
export MAMBA_EXE="/Users/ivy/miniforge3/bin/mamba"
export MAMBA_ROOT_PREFIX="/Users/ivy/miniforge3"
export PATH="/Users/ivy/miniforge3/bin:$PATH"

if [ -x "$MAMBA_EXE" ]; then
  __mamba_setup="$("$MAMBA_EXE" shell hook --shell zsh --root-prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
  if [ $? -eq 0 ]; then
    eval "$__mamba_setup"
  else
    echo "⚠️ Warning: Mamba shell hook failed to initialize"
    alias mamba="$MAMBA_EXE"
  fi
else
  echo "⚠️ Warning: Mamba not found at $MAMBA_EXE"
  alias mamba="$MAMBA_EXE"
fi
# <<< mamba initialize <<<
# reloaded 
source ~/.zshrc
exec zsh  # or just restart your terminal

# next checked output
echo $MAMBA_EXE
which mamba
type mamba
mamba --version
  • $MAMBA_EXE → /Users/ivy/miniforge3/bin/mamba
  • which mamba → /Users/ivy/miniforge3/bin/mamba
  • type mamba → mamba is /Users/ivy/miniforge3/bin/mamba (no function)

and the wrapper was removed when i typed mamba