How do I setup my dev box ?
- Aniket Patel
- Macbook , Development tools , Devops
- August 24, 2024
Hey,
This blog post serves as a guide to how I set up my MacBook and the tools I rely on. It’s primarily a reference for myself to streamline future configurations, but I hope it can also assist you in setting up your machine. If you’re the “I’ll figure it out” type, you may want to check out these two GitHub repositories instead.
Feel free to let me know if you need any further adjustments!
Easy way
zsh -c "$(curl -fsSL https://raw.githubusercontent.com/mehuaniket/dotfiles/main/scripts/setup.sh)"
Import
iterm_default_profile.json
by going to settings > profiles > other actions > import JSON profilesDelete old default profile
Restart Terminal
Open Nvim
nvim .
OR
Doing things hard way
Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "eval $(/opt/homebrew/bin/brew shellenv)" >> ~/.zshrc
source ~/.zshrc
Install iterm2
brew install iterm2
Install fzf and fd
brew install fd
brew install fzf
Installing oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
I suggest you start with the following:
zsh-autosuggestions: makes suggestions based on commands you have already made.
zsh-syntax-highlighting: enables highlighting of commands while they are typed.
Clone both plugins to your OhMyZsh custom folder.
cd ~/.oh-my-zsh/custom/plugins
git clone https://github.com/zsh-users/zsh-autosuggestions.git
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
Now, edit your ~/.zshrc file to include them.
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
Restart your Zsh with source ~/.zshrc.
Powerlevel10k
Powerlevel10k is a theme for Zsh. It emphasizes speed, flexibility and out-of-the-box experience.
Install the required fonts
Configure iterm2 by opening Preferences → Profiles. Go to default > text > Font (dropdown) > select MesloLGS NF Regular.
- Clone the repository
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
- Then, edit and powerlevel10k to
~/.zshrc
.
ZSH_THEME="powerlevel10k/powerlevel10k"
Restart Zsh with source ~/.zshrc
and follow the configuration wizard.
Choose your preferred style in the following screens.
Install tmux
- Use brew
brew install tmux
- start new session
tmux new
- You will notice that we have lost the colors we had before. Let’s bring them back with the next configs.
Install tpm to handle tmux plugins.
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
- Edit ~/.tmux.conf and replace conf file.
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
set -g @plugin 'dracula/tmux'
# Set 256 colors
set -s default-terminal 'tmux-256color'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
- Reload tmux environment
# type this in terminal if tmux is already running
tmux source ~/.tmux.conf
Press
Install github
brew install gh
Install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Install go
brew install go
Experimenting nvim
- Install nvim
brew install neovim
- Install nerd font
brew install font-hack-nerd-font
- Install lazyvim
rm -Rf ~/.local/state/nvim
rm -Rf ~/.local/share/nvim
rm -Rf ~/.cache/nvim
rm -Rf ~/.config/nvim
git clone --recurse-submodules https://github.com/mehuaniket/dotfiles ~/.dotfiles
- Install stow
brew install stow
- Installing nvim
stow nvim
stow zsh
stow tmux
stow fzf
source ~/.zshrc
tmux source ~/.tmux.conf
Press
Install kubectl and terraform
brew install kubectl
brew install terraform
Cheatsheet
tmux
- Ctr + space = prefix
- <prefix> + c = new window
- <prefix> + " = split window horizontally (new pane)
- <prefix> + %. = split window vertically (new pane)
- <prefix> + number = to switch between windows
- <prefix> + : = to insert command for tmux like (:rename-window debug)
- <prefix> + h/j/k/l = to switch between panes
- <prefix> + option + arrow (up/down/left/right) = to change size of the window
nvim
- Space = Prefix
- Ctr + h/j/k/l = to switch between window
- <prefix> + sf = search files
- <prefix> + sn = to change neo vim settings
- <prefix> + / = fuzzingly search current buffer
- <prefix> + b = to add breakpoints on file
- <prefix> + sk = keymaps list
- a = to create new file when you are on file tree
- r = to rename file when you are on file tree
- Ctr + f5 = to run file in debug mode