This guide explains how to use the bash scripts (.sh files) on macOS.
-
Bash: macOS includes bash by default (though newer versions use zsh as default shell, bash is still available)
which bash # Should show: /bin/bash or /usr/local/bin/bash -
SSH Client: macOS includes SSH by default
which ssh
-
rsync: macOS includes rsync by default
which rsync
-
Docker Desktop: Install Docker Desktop for Mac if you need to test locally
- Download from: https://www.docker.com/products/docker-desktop
cd /path/to/vulnerability-scannerCreate your VM configuration file:
cp config/.vm-config.example config/.vm-config
# Edit config/.vm-config with your VM details
nano config/.vm-config # or use your preferred editor (vim, code, etc.)chmod +x scripts/*.shThis should work fine on macOS since it's a native Unix filesystem.
All scripts are in the scripts/ directory. Run them from the project root:
# Sync code to VM
./scripts/sync-to-vm.sh
# OR
bash scripts/sync-to-vm.sh
# Full deployment
./scripts/deploy-to-vm.sh
# Check VM status
./scripts/check-vm-status.sh
# View logs
./scripts/view-vm-logs.sh
./scripts/view-vm-logs.sh backend # specific service
# Restart services
./scripts/restart-vm-services.sh
./scripts/restart-vm-services.sh backend # specific service
# Execute commands in containers
./scripts/vm-exec.sh backend rails console
./scripts/vm-exec.sh backend rails db:migrate
# Build Docker images
./scripts/build-vm-images.sh
# Start services
./scripts/start-vm-services.shIf you're using SSH keys, reference them with macOS paths:
# In config/.vm-config
SSH_KEY_PATH=/Users/yourusername/.ssh/id_ed25519
# or
SSH_KEY_PATH=~/.ssh/id_ed25519macOS home directories are at /Users/username/, so use:
SSH_KEY_PATH=/Users/YourUsername/.ssh/id_rsaIf you get "Permission denied" errors:
chmod +x scripts/*.shIf you see errors like $'\r': command not found, the scripts have Windows line endings. Fix them:
# Option 1: Use the helper script
bash scripts/fix-line-endings.sh
# Option 2: Use dos2unix (install via Homebrew if needed)
brew install dos2unix
dos2unix scripts/*.sh
dos2unix config/.vm-config*
# Option 3: Use sed
sed -i '' 's/\r$//' scripts/*.sh
sed -i '' 's/\r$//' config/.vm-config*Note: macOS sed requires the -i '' syntax (empty string after -i).
Test SSH connection first:
ssh user@your-vm-iprsync should be included with macOS, but if it's missing:
# Install via Homebrew
brew install rsyncIf you need Docker for local development:
- Install Docker Desktop for Mac: https://www.docker.com/products/docker-desktop
- Docker Compose is included with Docker Desktop
- Use Terminal.app or iTerm2: Both work great with bash scripts
- Stay in Project Root: Always run scripts from the project root directory
- Check Paths: Verify your
config/.vm-configpaths are correct for macOS - Use Tab Completion: macOS bash supports tab completion for easier navigation
- Homebrew: Consider installing Homebrew (https://brew.sh) for additional tools if needed
# 1. Navigate to project
cd /path/to/vulnerability-scanner
# 2. Configure VM (if not done)
cp config/.vm-config.example config/.vm-config
nano config/.vm-config
# 3. Make scripts executable
chmod +x scripts/*.sh
# 4. Deploy
./scripts/deploy-to-vm.sh- Native Unix: macOS is Unix-based, so scripts work natively without WSL
- File Permissions:
chmodworks normally (unlike WSL on Windows filesystem) - Paths: Use
/Users/username/instead of/home/username/or/mnt/... - No Line Ending Issues: macOS uses LF line endings by default (same as Linux)
- Terminal: Use Terminal.app, iTerm2, or any Unix terminal
- Native bash environment (no WSL needed)
- Works seamlessly with Linux tools (rsync, ssh, etc.)
- Standard Unix filesystem and permissions
- No execution policy restrictions
- Consistent with Linux/Unix development workflows