Skip to content

Instantly share code, notes, and snippets.

@atremblay
Last active February 23, 2024 13:44
Show Gist options
  • Save atremblay/90565eb4cc2130367092b0156d4ecec2 to your computer and use it in GitHub Desktop.
Save atremblay/90565eb4cc2130367092b0156d4ecec2 to your computer and use it in GitHub Desktop.
Mac setup script
platform=$(uname -s)
arch=$(uname -m)
PYTHON_VERSION=3.10
if [[ "$platform" == 'Linux' ]]; then
sudo apt install stow tldr
curl -sS https://starship.rs/install.sh | sh
git clone --depth 1 https://github.com/wbthomason/packer.nvim\ ~/.local/share/nvim/site/pack/packer/start/packer.nvim
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
elif [[ $"platform" == 'Darwin' ]]; then
# Set keyboard repeat rate
defaults write -g InitialKeyRepeat -int 15
defaults write -g KeyRepeat -int 2
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true # show full path in Finder
defaults write com.apple.finder _FXSortFoldersFirst -bool true # Always put folder first in Finder
defaults write NSGlobalDomain AppleShowScrollBars -string "Always" # Always show scroll bar
defaults write com.apple.doc static-only -bool true # Only show active app in the Dock
killall Finder Dock
# Fetch and install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install utils
brew install wget git tmux watch neovim tldr fd bat ansible ripgrep exa neofetch stow vlc stylua dust starship fzf ruff
brew install koekeishiya/formulae/skhd koekeishiya/formulae/yabai transmission-cli
brew install --cask alacritty kitty
# Fonts
# Additionnal fonts here https://github.com/Homebrew/homebrew-cask-fonts
# Preview here https://www.nerdfonts.com/font-downloads
# for this vim plugin https://github.com/ryanoasis/vim-devicons
brew tap homebrew/cask-fonts
brew install --cask font-fira-code-nerd-font
brew install --cask font-hack-nerd-font
# To install useful key bindings and fuzzy completion:
$(brew --prefix)/opt/fzf/install
fi
# Install rust/cargo
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup_install.sh
sh rustup_install.sh -y
rm rustup_install.sh
cargo install eza
# Batch rename files using EDITOR
curl https://raw.githubusercontent.com/thameera/vimv/master/vimv > ~/.local/bin/vimv && chmod 755 ~/.local/bin/vimv
# Install Tmux Package Manager (tpm)
# ******Once in tmux, need to do ctrl+b I (shift+i)*******
# https://github.com/tmux-plugins/tpm
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# Install oh-my-zsh
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
# Install my dotfiles
git clone https://github.com/atremblay/dotfiles.git $HOME/dotfiles
cd $HOME/dotfiles
stow */
# Setup various fonts. This is done for user, not system.
cd $HOME
git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
cd ..
rm -rf fonts
#------------------------------------------------------------------------------#
# Miniconda #
#------------------------------------------------------------------------------#
if [ ! -d "$HOME"/miniconda3 ]; then
if [ "$platform" == "Darwin" ]; then
platform_name=MacOSX
elif [ "$platform" == "Linux" ]; then
platform_name=Linux
fi
url_prefix=https://repo.anaconda.com/miniconda
curl -L $url_prefix/Miniconda3-latest-$platform_name-"$arch".sh -o miniconda.sh
bash miniconda.sh -b -p "$HOME"/miniconda3
rm miniconda.sh
"$HOME"/.miniconda3/bin/conda create --yes --name neovim python="$PYTHON_VERSION"
"$HOME"/.miniconda3/envs/neovim/bin/pip install toml gitpython pynvim black isort pyright
"$HOME"/.miniconda3/bin/conda install --yes -c conda-forge shellcheck
conda config --set changeps1 False
fi
# Additionnal notes
# - If zsh startup time is slow, use this the profile the starting script https://jb-blog.readthedocs.io/en/latest/posts/0032-debugging-zsh-startup-time.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment