Un-F%ck your M2 for development
- Published
- Tags
- #env#freshstart#mac
Lets get some sane defaults
Disable System Integrity M2 Mac
Shut down computer, hold down power till it shows options, log in, Utilities -> Terminal (More Info)https://github.com/koekeishiya/yabai/wiki/Disabling-System-Integrity-Protection
bash
csrutil enable --without fs --without debug --without nvram
Then as another command
bash
csrutil disable --with kext --with dtrace --with basesystem
Reboot into normal OS
bash
sudo nvram boot-args=-arm64e_preview_abi
Terminal Tools
bash
xcode-select --install
Folders
bash
mkdir ~/Utilities
mkdir ~/Git
mkdir ~/Git/Webdev
mkdir ~/Git/Typescript
mkdir ~/Git/Rust
mkdir ~/Git/Go
mkdir ~/Git/Python
mkdir ~/Git/External
Prezto
bash
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
Homebrew
bash
if which brew > /dev/null; then
echo "Homebrew is already installed."
else
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew analytics off
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
Git
bash
brew install gh
git config --global user.name "Thevetat"
git config --global user.email "thevetat@proton.me"
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
git config --global init.defaultBranch main
git config -l
SSH
bash
mkdir -p ~/.ssh
cd ~/.ssh
ssh-keygen -t ed25519 -C "github" -f "github"
ssh-keygen -t ed25519 -C "gitlab" -f "gitlab"
touch ~/.ssh/config
echo "# GitHub
Host github.com
HostName github.com
AddKeysToAgent yes
UseKeychain yes
User git
IdentityFile ~/.ssh/github
# GitLab
Host gitlab.com
HostName gitlab.com
User git
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/gitlab" >> ~/.ssh/config
ssh-add --apple-use-keychain ~/.ssh/github
ssh-add --apple-use-keychain ~/.ssh/gitlab
gh auth login
Sane Defaults
bash
defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.spaces spans-displays -bool false
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock "mru-spaces" -bool "false"
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
defaults write com.apple.LaunchServices LSQuarantine -bool false
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
defaults write NSGlobalDomain _HIHideMenuBar -bool true
defaults write NSGlobalDomain AppleHighlightColor -string "0.65098 0.85490 0.58431"
defaults write NSGlobalDomain AppleAccentColor -int 1
defaults write com.apple.screencapture location -string "$HOME/Desktop"
defaults write com.apple.screencapture disable-shadow -bool true
defaults write com.apple.screencapture type -string "png"
defaults write com.apple.finder DisableAllAnimations -bool true
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool false
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false
defaults write com.apple.finder ShowMountedServersOnDesktop -bool false
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool false
defaults write com.apple.Finder AppleShowAllFiles -bool true
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
defaults write com.apple.finder ShowStatusBar -bool false
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool YES
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
defaults write com.apple.Safari IncludeDevelopMenu -bool true
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
NVM
bash
if ! command -v nvm &> /dev/null
then
echo "NVM is not installed. Installing NVM and configuring NPM..."
echo "source $(brew --prefix nvm)/nvm.sh" >> ~/.zshrc
source ~/.zshrc
nvm install --lts
node -v && nvm -v
else
echo "NVM is already installed. Skipping NVM installation."
fi
if command -v npm &> /dev/null
then
echo "npm is installed. Configuring npm..."
npm install -g npm@latest
npm --init-author-name "Thevetat"
npm --init-author-email "thevetat@proton.me"
npm --init-author-url "https://www.thevetatsramblings.com"
else
echo "npm is not installed. Attempting to reinstall Node and npm..."
nvm install --lts
fi
Go
bash
export PATH="$PATH:/Users/thevetat/go/bin"
go install mvdan.cc/gofumpt@latest
go install -v github.com/incu6us/goimports-reviser/v3@latest
go install github.com/fatih/gomodifytags@latest
echo "export PATH=\"$PATH:/Users/thevetat/go/bin\"" >> ~/.zshrc
Rust
bash
echo "Installing Rust and cargo related packages"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
echo "source \"$HOME/.cargo/env\"" >> ~/.zshrc
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
cargo install tree-sitter-cli
cargo install procs
cargo install sd
cargo install du-dust
cargo install tokei
cargo install bottom
cargo install tealdeer
cargo install grex
cargo install zoxide
cargo install stylua
cargo install silicon
cargo install ripgrep
cargo install exa
cargo install --locked zellij
cargo install deno --locked
source $HOME/.zshrc
XCode and Vimari
bash
mas install 497799835
mas install 1480933944
bash
# Copying and checking out configuration files
echo "Planting Configuration Files..."
[ ! -d "$HOME/dotfiles" ] && git clone --bare git@github.com:Thevetat/dotfiles_mac.git $HOME/dotfiles
git --git-dir=$HOME/dotfiles/ --work-tree=$HOME checkout main
echo "source ~/.aliases
source ~/.zprofile
source ~/.zsh_functions\n" >> ~/.zshrc
# Installing Fonts
git clone git@github.com:shaunsingh/SFMono-Nerd-Font-Ligaturized.git /tmp/SFMono_Nerd_Font
mv /tmp/SFMono_Nerd_Font/* $HOME/Library/Fonts
rm -rf /tmp/SFMono_Nerd_Font/
curl -L https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v1.0.4/sketchybar-app-font.ttf -o $HOME/Library/Fonts/sketchybar-app-font.ttf
source $HOME/.zshrc
# Python Packages
echo "Installing Python Packages..."
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -p $HOME/miniconda
rm -r -f ~/miniconda.sh
source $HOME/.zshrc
conda install -c apple tensorflow-deps
conda install -c conda-forge pybind11
conda install matplotlib
conda install jupyterlab
conda install seaborn
conda install opencv
conda install joblib
conda install pytables
pip install tensorflow-macos
pip install tensorflow-metal
pip install debugpy
pip install scikit-learn
echo 'eval "$(zoxide init zsh)"\n' >> ~/.zshrc
# Start Services
echo "Starting Services (grant permissions)..."
brew services start fskhd
brew services start fyabai
brew services start sketchybar
brew services start svim
csrutil status
echo "Do not forget to disable SIP and reconfigure keyboard -> $HOME/.config/keyboard..."
open "$HOME/.config/keyboard/KeyboardModifierKeySetup.png"
echo "Add sudoer manually:\n '$(whoami) ALL = (root) NOPASSWD: sha256:$(shasum -a 256 $(which yabai) | awk "{print \$1;}") $(which yabai) --load-sa' to '/private/etc/sudoers.d/yabai'"
echo "Installation complete..."