Last active
March 25, 2024 05:34
-
-
Save rchatham/8824b094ce32523b2cc8f82fe1eb9df7 to your computer and use it in GitHub Desktop.
Setup script for new macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Make Dock only show active apps | |
defaults write com.apple.dock static-only -bool true; killall Dock | |
defaults write com.apple.finder _FXSortFoldersFirst -bool true; killall Finder | |
# Check if Homebrew is installed and install if not | |
if ! command -v brew &> /dev/null | |
then | |
echo "Installing Homebrew..." | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
fi | |
# Update .zshrc if not exists - done before installing zsh | |
if [ ! -f "$HOME/.zshrc" ] | |
then | |
echo "Setting up .zshrc..." | |
curl https://gist.githubusercontent.com/rchatham/d798827061fbd1e1c04a2c1b0c284a00/raw >> ~/.zshrc | |
fi | |
# Install Homebrew packages | |
brew install --cask clipy iterm2 amethyst anaconda vlc blackhole-16ch | |
brew tap homebrew/cask-fonts | |
brew install zsh zsh-autosuggestions zsh-syntax-highlighting powerlevel10k font-hack-nerd-font neovim bat eza gh tmux rg fd fzf dust btop jq comby zoxide tldr midnight-commander 1password-cli | |
$(brew --prefix)/opt/fzf/install | |
# Install Oh My Zsh if not already installed | |
if [ ! -d "$HOME/.oh-my-zsh" ] | |
then | |
echo "Installing Oh My Zsh..." | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
fi | |
# Clone powerlevel10k theme if it is not already installed | |
P10K_DIR="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k" | |
if [ ! -d "$P10K_DIR" ]; then | |
echo "Installing powerlevel10k theme..." | |
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$P10K_DIR" | |
else | |
echo "powerlevel10k theme already installed." | |
fi | |
# Update tmux.conf if not exists | |
if [ ! -f "$HOME/.config/tmux/tmux.conf" ] | |
then | |
echo "Setting up tmux.conf..." | |
mkdir -p "$HOME/.config/tmux" | |
curl https://gist.githubusercontent.com/rchatham/4a2cd1bf32eaf1f749993dbb7859dadf/raw >> ~/.config/tmux/tmux.conf | |
fi | |
# Install Tmux plugins | |
if [ ! -d "$HOME/.tmux/plugins/tpm" ] | |
then | |
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm | |
fi | |
tmux source ~/.config/tmux/tmux.conf | |
# Neovim config | |
if [ ! -d "$HOME/.config/nvim" ] | |
then | |
git clone https://github.com/rchatham/nvim-config.git .config/nvim | |
fi | |
# Python | |
brew install pyenv pyenv-virtualenv | |
# Ruby | |
brew install ruby rbenv ruby-build | |
# Swift tools | |
brew install aria2 xcodesorg/made/xcodes swiftformat swiftlint xcbeautify | |
xcodes install --latest --experimental-unxip | |
gem install xcodeproj | |
# Completions for xcodes | |
mkdir -p ~/.oh-my-zsh/completions | |
xcodes --generate-completion-script > ~/.oh-my-zsh/completions/_xcodes | |
# Git configuration | |
git config --global push.autoSetupRemote true | |
# GitHub CLI auth | |
if ! gh auth status &> /dev/null | |
then | |
echo "Logging into GitHub CLI..." | |
gh auth login | |
fi | |
# Update .zshrc if not exists - done before installing zsh | |
if [ ! -f "$HOME/.amethyst.yml" ] | |
then | |
echo "Setting up .amethyst.yml..." | |
curl https://gist.githubusercontent.com/rchatham/33278ad3893e903123954f17de44a0bf/raw >> ~/.amethyst.yml | |
fi | |
if [ ! -f "/Library/LaunchAgents/com.warpd.warpd.plist" ] | |
then | |
echo "Downloading warpd..." | |
curl -L https://github.com/rvaiya/warpd/releases/download/v1.3.5/warpd-1.3.5-osx.tar.gz | sudo tar xzvfC - / && launchctl load /Library/LaunchAgents/com.warpd.warpd.plist | |
fi | |
read -p "Do you want to install this csview and visidata? (y/n) " answer | |
if [ "$answer" != "${answer#[Yy]}" ]; then | |
echo "Installing csv tools..." | |
brew install csview saulpw/vd/visidata | |
npm install -g google-sheet-cli | |
fi | |
read -p "Do you want to install this Tetris? (y/n) " answer | |
if [ "$answer" != "${answer#[Yy]}" ]; then | |
echo "Installing Tetris..." | |
brew install samtay/tui/tetris | |
fi | |
echo "Remember to enable the 'Hack Nerd Font Mono' in iTerm2 > Settings > Profiles > Text > Font" |
If bindkey "^X^E" edit-command-line
is set on .zshrc
, Ctrl-x
+Ctrl-e
will open the current command in your editor. (This is standard in Bash) https://stackoverflow.com/a/22656375/4525974
Using warpd keyboard mouse:
Grid Mode:
- Press A-M-g (meta is the command key) to activate the warping process.
- Use u,i,j,k to repeatedly navigate to different quadrants.
- Press m to left click, , to middle click or . to right click.
Normal Mode:
- Press A-M-c to activate normal mode.
- Use the normal movement keys (default hjkl) to adjust the cursor.
- Press m to left click, , to middle click or . to right click.
- Press escape to quit.
A drag movement can be simulated from any of the above modes by focusing on the source and then pressing the drag_key (default v) which will cause normal mode to be activated for selection of the drag target.
Other tools and resources:
File Managers:
- Ranger: https://ranger.github.io/
- Midnight Commander: https://midnight-commander.org/
- MC Cheat Sheet: https://gist.github.com/samiraguiar/9cd4264445545cfd459d
Set up a global .gitignore to prevent IDE files and other files related to local development from needing to be added to a individual repository's .gitignore. https://gist.github.com/subfuzion/db7f57fff2fb6998a16c
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If
set -o vi
is set in your.bashrc
or.zshrc
, you can useEsc
to usej
&k
to navigate your command history and/{command}
with
n
&N
to search your command history.