macOS Setup

Some basics about setting up a development environment on macOS.

In the terminal, run

1
sudo xcode-select --install
1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Install Zsh first:

1
brew install zsh

Then install Oh My Zsh:

1
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Edit ~/.zshrc:

1
2
3
4
5
6
7
plugins=(
  sudo
  extract
  autojump
  zsh-autosuggestions
  zsh-syntax-highlighting
)

Press ESC twice to add sudo to the beginning of the command.

Use x abc.zip to extract abc.zip. It supports almost all compressed formats.

1
brew install autojump

Follow the instructions to add the following line to ~/.zshrc:

1
2
3
# >>> autojump initialize >>>
  [ -f /opt/homebrew/etc/profile.d/autojump.sh ] && . /opt/homebrew/etc/profile.d/autojump.sh
# <<< autojump initialize <<<

Use j to jump to the matching directory.

1
j <keyword>

auto-suggestion for zsh. It suggests commands based on your command history.

1
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

Syntax highlighting for zsh. It should be the last plugin in the plugins list.

1
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

I prefer the powerlevel10k theme. One can find the installation instructions here.

  1. clone the repository

    1
    
    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
    
  2. Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc.

  3. Run p10k configure to configure the theme. (It will be automatically run when you open a new terminal window. I prefer not to install the recommended fonts.)

tldr is a community effort to simplify the beloved man pages with practical examples.

1
brew install tldr

To use it, run

1
tldr <command>

tree is a recursive directory listing command that produces a depth indented listing of files.

1
brew install tree

See conda-basics for more details.

See ssh-basics for more details.

See git-basics for more details.

Delete all .DS_Store files recursively and print the path of each deleted file:

1
find . -name ".DS_Store" -print -delete