Setup MacOS
Running documentation for the MacOS setup in Janaki.
Bash
- Install
bash version 5.2.15(1)
using homebrew following instructions in this blog post. However, I could not create the Symlink by disabling SIP (csrutil disable
). - The pre-installed old bash still exists in
/bin/bash
. Therefore, I have to write bash scripts using#!/usr/bin/env bash
. - Update my
dotfiles
for Mac specific utilities.
Homebrew
- Why don’t they ship this package manager as default in MacOS?
Terminal
- The default terminal in Mac does not support 24 bit color, and many other Unix features which I use regularly (for example, middle click paste).
- Install iterm2 using homebrew
brew install --cask iterm2
Latex
- I do not want the GUI packages of MacTex, but I want full TexLive.
- For a finer control over TexLive, I decided to clone the TexLive repository and install from there.
brew install wget
mkdir -p /opt/texlive-repository
chown -R sbanerjee:staff /opt/texlive-repository
update-texlive-repository /opt/texlive-repository # this is an alias to clone the repository, takes couple of hours
- Finally, install TexLive from the repository
gcc / gfortran
- Just install with Homebrew.
brew info gcc
brew install gcc
R
- Requires gfortran, TeX, tcltk
- Install using pkg file provided by R.
Python
brew install micromamba
micromamba shell -s bash -p /opt/micromamba -vvv init
This will install micromamba and choose /opt/micromamba
as the root prefix. Sample output:
Modifying RC file "/Users/sbanerjee/.bash_profile"
Generating config for root prefix "/opt/micromamba"
Setting mamba executable to: "/usr/local/bin/micromamba"
Adding (or replacing) the following in your "/Users/sbanerjee/.bash_profile" file
# >>> mamba initialize >>>
# !! Contents within this block are managed by 'mamba init' !!
export MAMBA_EXE="/usr/local/bin/micromamba";
export MAMBA_ROOT_PREFIX="/opt/micromamba";
__mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__mamba_setup"
else
if [ -f "/opt/micromamba/etc/profile.d/micromamba.sh" ]; then
. "/opt/micromamba/etc/profile.d/micromamba.sh"
else
export PATH="/opt/micromamba/bin:$PATH" # extra space after export prevents interference from conda init
fi
fi
unset __mamba_setup
# <<< mamba initialize <<<
Note. I deleted these initialization scripts from .bash_profile
and added them to ~/.custom_dotfiles/bashrc
because that is my preferred bash configuration file.
Installed Python environment and changed the repository to conda-forge using ~/.mambarc
micromamba create --name py311 python=3.11 -c conda-forge
Quarto
- Use
.dmg
file to install Quarto.
Vim
- Bash syntax highlighting was broken in Vim shipped by Macbook - see issue here. I installed latest vim using Homebrew.