This repository contains scripts to automate the setup of a new Mac for development. It's designed to be modular, allowing you to pick and choose which components to install.
- Homebrew: Package manager for macOS
- Development Tools: Install packages from Brewfile
- Shell Setup: Configure Zsh, Oh My Zsh, plugins, and themes
- Git Configuration: Set up Git with useful aliases and configurations
- Node.js Setup: Install nvm, Node.js, and pnpm
- Python Setup: Install pyenv, Python versions, and uv
- Oh My Zsh Backup: Backup and restore your Oh My Zsh configuration
- macOS Preferences: Configure macOS settings for development
- VSCode Setup: Backup and restore VSCode settings, extensions, and snippets
- Comprehensive Mac Backup: Backup all essential settings from your Mac
- Security-Focused Design: Clear separation between public-safe and private backups
- macOS (tested on macOS Ventura and later)
- Internet connection
- Admin privileges
This repository is designed to be used in two phases:
- Backup Phase (On Your Old Mac): Run the backup script on your existing Mac to save your settings, configurations, and preferences.
- Setup Phase (On Your New Mac): Use this repository on your new Mac and run the setup script to restore your environment.
Since this repository contains scripts that will backup your personal settings, you'll need to decide how to handle these backups:
- Fork or clone this repository
- Use the backup script which will automatically separate public-safe and private backups
- Commit only the public-safe backups to your repository
- Keep private backups local or in a secure storage solution
- Create a new private repository on GitHub/GitLab/etc.
- Clone this repository and push it to your private repository:
# Clone this repository git clone https://github.com/sanjeed5/new-mac-setup.git cd new-mac-setup # Change the remote to your private repository git remote remove origin git remote add origin https://github.com/YOUR_USERNAME/YOUR_PRIVATE_REPO.git # Push to your private repository git push -u origin main
- Clone this repository
- Run the backup script which will create local backups
- Transfer these backups to your new Mac using external storage or file sharing
-
Set up the repository using one of the options above, then:
-
Make the backup script executable:
chmod +x backup.sh
-
Run the backup script:
./backup.sh
-
The script will guide you through backing up different components into the
backups/
directory:backups/homebrew/
: Homebrew packages and Brewfilebackups/vscode/
: VSCode settings, keybindings, snippets, and extensionsbackups/ohmyzsh/
: Oh My Zsh configuration, themes, and pluginsbackups/git/
: Git configuration and global settingsbackups/macos/
: macOS system preferences and settings
-
If using a repository:
# For public repositories, only commit the public backups git add backups/public git commit -m "Backup my public Mac settings" git push # For private repositories, you may choose to commit private backups as well git add backups/private git commit -m "Backup my private Mac settings" git push
If using local backups only, copy the
backups
directory to external storage.
-
Clone the repository:
git clone https://github.com/YOUR_USERNAME/YOUR_REPO.git cd YOUR_REPO
If using local backups, copy your backup files to the appropriate location:
# Copy your backup files to the backups directory cp -r /path/to/your/backups/* backups/
-
Make the setup script executable:
chmod +x setup.sh
-
Run the setup script:
./setup.sh
-
Follow the prompts to select which components to install and restore from your backup. The script will ask for necessary information (like Git username and email) during the setup process.
This repository is designed with security in mind:
All backups are stored in the backups/
directory with the following organization:
-
Public-Safe Backups:
backups/homebrew/
: Brewfile and package listsbackups/vscode/extensions.txt
: VSCode extensions listbackups/ohmyzsh/
: Oh My Zsh themes and plugins- Other non-sensitive configurations
-
Private/Sensitive Backups:
backups/git/
: Git configuration (may contain email)backups/vscode/settings.json
: VSCode settings (may contain tokens)backups/macos/
: System preferences (may contain personal settings)- Other potentially sensitive data
IMPORTANT: Never commit sensitive information to a public repository, including:
- Private SSH keys
- API tokens or passwords
- Personal credentials
- Database connection strings with passwords
- Public Repositories: Only commit non-sensitive backups
- Private Repositories: You may commit both directories, but review files first
- Highly Sensitive Data: Consider keeping SSH keys and credentials completely separate from any repository
- Review Before Committing: Always check files for sensitive information before committing
- Use Environment Variables: Consider using environment variables or a secure vault for sensitive information
The backup script:
- Creates necessary directories in
backups/
- Presents options for backing up different components
- Automatically categorizes backups as public-safe or private/sensitive
- Provides multiple security warnings for sensitive data
- Creates timestamped archives of your backups
The setup script:
- Installs core development tools (Homebrew, packages from Brewfile)
- Sets up your shell environment (Zsh, Oh My Zsh, plugins)
- Configures development tools (Node.js, Python)
- Sets up Git with your information
- Configures macOS preferences for development
- Restores settings from your backups in the
backups/
directory
.
├── Brewfile # Homebrew packages and applications
├── README.md # This file
├── backup.sh # Main backup script
├── setup.sh # Main setup script
├── backups/ # All backups are stored here
│ ├── public/ # Public-safe backups
│ └── private/ # Private/sensitive backups
└── scripts/ # Individual scripts
├── backup_*.sh # Individual backup scripts
├── install_*.sh # Installation scripts
├── restore_*.sh # Restoration scripts
└── setup_*.sh # Setup scripts
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
This project was inspired by various dotfiles repositories and setup scripts from the developer community.