Created
January 22, 2025 18:33
-
-
Save aakashb95/6b5f4799633b649814f2bf3ecb518710 to your computer and use it in GitHub Desktop.
MacOS setup
This file contains hidden or 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 | |
echo "Setting up development environment for macOS..." | |
# Install Homebrew if not installed | |
if ! command -v brew &> /dev/null; then | |
echo "Installing Homebrew..." | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
# Add Homebrew to PATH for Apple Silicon Macs | |
if [[ $(uname -m) == 'arm64' ]]; then | |
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile | |
eval "$(/opt/homebrew/bin/brew shellenv)" | |
fi | |
fi | |
# Install packages | |
echo "Installing packages..." | |
brew install zsh fzf bat rectangle raycast orbstack | |
# Setup fzf | |
echo "Setting up fzf..." | |
$(brew --prefix)/opt/fzf/install --all | |
# Install oh-my-zsh | |
echo "Installing oh-my-zsh..." | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended | |
# Make zsh default shell | |
if [[ "$SHELL" != "/bin/zsh" ]]; then | |
echo "Making zsh the default shell..." | |
chsh -s $(which zsh) | |
fi | |
# Install zsh plugins | |
echo "Installing zsh plugins..." | |
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | |
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting | |
git clone https://github.com/agkozak/zsh-z ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-z | |
# Update plugins in .zshrc | |
echo "Configuring zsh plugins..." | |
sed -i '' 's/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting zsh-z)/' ~/.zshrc | |
# Add fzf and bat configs to .zshrc | |
echo "Configuring fzf and bat..." | |
echo '# Enable fzf key bindings and completion | |
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh | |
# Alias bat as cat if available | |
if command -v bat &> /dev/null; then | |
alias cat="bat --paging=never" | |
fi' >> ~/.zshrc | |
# Install uv package manager | |
echo "Installing uv package manager..." | |
curl -LsSf https://astral.sh/uv/install.sh | sh | |
# Install Miniconda | |
echo "Installing Miniconda..." | |
mkdir -p ~/miniconda3 | |
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o ~/miniconda3/miniconda.sh | |
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 | |
rm -rf ~/miniconda3/miniconda.sh | |
~/miniconda3/bin/conda init bash | |
~/miniconda3/bin/conda init zsh | |
# Configure system preferences | |
echo "Configuring system preferences..." | |
# Create Screenshots directory | |
mkdir -p ~/Screenshots | |
defaults write com.apple.screencapture location ~/Screenshots | |
defaults write com.apple.screencapture type jpg | |
# Keyboard settings | |
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false | |
defaults write NSGlobalDomain KeyRepeat -int 2 | |
defaults write NSGlobalDomain InitialKeyRepeat -int 15 | |
# Trackpad settings | |
defaults write -g com.apple.trackpad.forceClick 0 | |
defaults write -g com.apple.trackpad.scaling 2.0 | |
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true | |
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true | |
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 | |
# Mouse settings | |
defaults write -g com.apple.mouse.scaling 3.0 | |
defaults write -g com.apple.scrollwheel.scaling 5.0 | |
# Replace Spotlight with Raycast | |
echo "Configuring Raycast..." | |
osascript -e 'tell application "System Events" to set "Raycast" to keyboard shortcut "command space"' | |
# Create backup of original zshrc for uninstallation | |
cp ~/.zshrc ~/.zshrc.backup | |
# Restart system services | |
echo "Restarting system services..." | |
killall SystemUIServer | |
killall Finder | |
echo "Setup complete! Please restart your terminal." | |
echo "Note: Some changes may require a system restart to take effect." | |
# Start zsh | |
exec zsh -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment