Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store
.AppleDouble
.LSOverride
.Spotlight-V100
.Trashes
Icon
._*
77 changes: 77 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# macOS Setup Script

Automated macOS setup script that installs Homebrew, apps, fonts, and configures system defaults.

## Oneliner (Needs sudo account permissions)
curl -fsSL https://raw.githubusercontent.com/samsoeapp/macos/refs/heads/main/macos-setup-client/prep.sh | sudo bash

## Oneliner with Client Profile
Use `--client NAME` or a positional `NAME`.

curl -fsSL https://raw.githubusercontent.com/samsoeapp/macos/refs/heads/main/macos-setup-client/prep.sh | sudo bash -s -- --client RD
curl -fsSL https://raw.githubusercontent.com/samsoeapp/macos/refs/heads/main/macos-setup-client/prep.sh | sudo bash -s -- RD

## Quick Start

1. Copy the `macos-setup` folder to your Mac
2. Open Terminal and navigate to the folder
3. Run: `./prep.command`
4. Enter your admin password when prompted

## Files

### `prep.command`
Main executable script. Run this to set up your Mac.

### `.Brewfile`
Homebrew packages (formulae, casks, fonts). Contains brief editing instructions at the top of the file.

### `.Masfile`
Mac App Store apps. One app per line: `app_id|App Name`. Contains brief editing instructions at the top of the file.

### `.prep-YYYYMMDD.log`
Hidden log file with detailed output from script runs. Appends if run multiple times on the same day.

## What It Does

1. Obtains admin privileges (password stored securely)
2. Installs Homebrew (if needed)
3. Prepares Homebrew (updates, configures)
4. Installs Rosetta 2 (Apple Silicon only)
5. Installs packages from `.Brewfile`
6. Sets default browser from `prep.command`
7. Configures Dock from `prep.command`
8. Applies macOS defaults from `prep.command`
9. Cleans up Homebrew locks
10. Installs App Store apps from `.Masfile` (optional, requires Apple ID)

## Editing Files

Each file (`.Brewfile`, `.Masfile`) contains brief editing instructions at the top. Open the file to see how to add/remove items.

## Requirements

- macOS (tested on macOS Sonoma+)
- Admin account
- Internet connection

## Troubleshooting

- **Script fails**: Check that `prep.command` is executable: `chmod +x prep.command`
- **Gatekeeper prompt on double-click**: Remove quarantine once: `xattr -dr com.apple.quarantine prep.command` (or run it from Terminal)
- **Homebrew fails**: Check internet connection or install manually from https://brew.sh
- **App Store apps**: Sign in to Mac App Store first: `open -a "App Store"`
- **Dock fails**: Grant Terminal.app Full Disk Access in System Settings
- **Full log**: Check `.prep-YYYYMMDD.log` for detailed output

## Settings Scope

**Most settings are user-only** (apply only to the current user). Only 2 settings are system-wide:
- `/Volumes` folder visibility (affects all users)
- Login window hostname display (affects all users)

All other settings (Finder, Safari, Dock, screenshots, etc.) are user-specific. See `SETTINGS_SCOPE.md` for details.

## Security

Password is stored securely in a temporary file, cleared from memory immediately, and deleted on script exit.
69 changes: 69 additions & 0 deletions macos-setup-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# macOS Setup Client

Lightweight macOS setup script that installs Homebrew packages and applies
user defaults. Configuration lives inline in `prep.sh`.

## Oneliner (Admin access required for Homebrew install)
curl -fsSL https://raw.githubusercontent.com/samsoeapp/macos/refs/heads/main/macos-setup-client/prep.sh | sudo bash

## Oneliner with Client Profile
Use `--client NAME` or a positional `NAME`.

curl -fsSL https://raw.githubusercontent.com/samsoeapp/macos/refs/heads/main/macos-setup-client/prep.sh | sudo bash -s -- --client RD
curl -fsSL https://raw.githubusercontent.com/samsoeapp/macos/refs/heads/main/macos-setup-client/prep.sh | sudo bash -s -- RD

## Quick Start

1. Copy the `macos-setup-client` folder to your Mac
2. Open Terminal and navigate to the folder
3. Run: `./prep.sh`
4. Optional: `./prep.sh --client RD`

## Files

### `prep.sh`
Main executable script. All configuration is inline in this file.

### `.prep-defaults-YYYYMMDD.log`
Hidden log file written to `~/Downloads`. Appends if run multiple times on the same day.

## What It Does

1. Ensures Xcode Command Line Tools are installed
2. Installs Homebrew (if needed)
3. Installs Homebrew formulae and casks (inline lists)
4. Closes System Settings (to avoid conflicts)
5. Applies macOS defaults (or reverts with `--revert`)
6. Restarts affected apps (Safari, Finder)

## Editing Configuration

Edit `prep.sh` directly:
- Default apps: `DEFAULT_BROWSER` (and optional defaults)
- Homebrew packages: `BREW_FORMULAE`, `BREW_CASKS`
- Mac App Store apps: `MAS_APPS` (currently disabled in the script)
- macOS defaults: `apply_defaults` / `apply_defaults_revert`
- Admin-only commands: commented at the end of the file

Client profiles live in `profiles/NAME.sh` and can override or append to any of
the variables above.

## Requirements

- macOS (tested on macOS Sonoma+)
- Internet connection
- Admin account (for Homebrew install)

## Troubleshooting

- **Script fails**: Ensure executable: `chmod +x prep.sh`
- **Homebrew fails**: Check internet connection or install manually from https://brew.sh
- **App Store apps**: Uncomment the MAS section and sign in first: `open -a "App Store"`
- **Full log**: Check `~/Downloads/.prep-defaults-YYYYMMDD.log`

## Settings Scope

All defaults in `prep.sh` are user-level. Two admin-only settings are present
but commented out at the end of the file:
- `/Volumes` folder visibility
- Login window hostname display
Loading