macOS Setup
Some basics about setting up a development environment on macOS.
Xcode
In the terminal, run
sudo xcode-select --install
Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Oh My Zsh
Install Zsh first:
brew install zsh
Then install Oh My Zsh:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Plugins
Edit ~/.zshrc:
plugins=(
sudo
extract
autojump
zsh-autosuggestions
zsh-syntax-highlighting
)
sudo
Press ESC twice to add sudo to the beginning of the command.
extract
Use x abc.zip to extract abc.zip. It supports almost all compressed formats.
autojump
brew install autojump
Follow the instructions to add the following line to ~/.zshrc:
# >>> 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.
j <keyword>
zsh-autosuggestions
auto-suggestion for zsh. It suggests commands based on your command history.
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
zsh-syntax-highlighting
Syntax highlighting for zsh. It should be the last plugin in the plugins list.
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
Theme
I prefer the powerlevel10k theme. One can find the installation instructions here.
-
clone the repository
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k -
Set
ZSH_THEME="powerlevel10k/powerlevel10k"in~/.zshrc. -
Run
p10k configureto configure the theme. (It will be automatically run when you open a new terminal window. I prefer not to install the recommended fonts.)
High-efficiency software
tldr
tldr is a community effort to simplify the beloved man pages with practical examples.
brew install tldr
To use it, run
tldr <command>
tree
tree is a recursive directory listing command that produces a depth indented listing of files.
brew install tree
.gitignore
Set the global .gitignore file:
curl https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore -o ~/.gitignore
Config git to use the global .gitignore file:
git config --global core.excludesfile ~/.gitignore
visit gitignore to generate a .gitignore file for your project.
conda
See conda-basics for more details.