A fully automated, lightweight, and professional MAMP Pro alternative for macOS.
BAMP = Brew + Apache + MySQL + PHP A transparent, reproducible, and fully controllable local development environment.
MAMP Pro Problems:
- π° Expensive licensing
- π Closed-source and opaque
- ποΈ Messy file organization
- π Resource-heavy and bloated
- π§ Limited customization options
BAMP Solutions:
- β 100% Free & Open Source - MIT licensed
- β Transparent Setup - Every step is visible and customizable
- β Lightweight - Only installs what you need
- β Professional Grade - Real SSL, proper DNS, enterprise features
- β Team Friendly - Reproducible across development teams
- β Clean Uninstall - Complete removal when no longer needed
- β Complete Ecosystem - Full suite of management tools
# Download and install globally
curl -fsSL https://raw.githubusercontent.com/amitdugar/bamp/main/install.sh | bash
# Now use anywhere:
bamp 8.4 # Install/switch PHP version
bamp-vhost myapp /path # Create virtual host
bamp-mysql list # List databases
bamp-uninstall # Remove BAMP
Benefits:
- β Zero dependencies - No git required
- β One command - Download and install instantly
- β
Global commands - Use
bamp
from anywhere - β Auto PATH setup - Handles shell configuration
# Download individual scripts
curl -O https://raw.githubusercontent.com/amitdugar/bamp/main/bamp.sh
curl -O https://raw.githubusercontent.com/amitdugar/bamp/main/bamp-vhost.sh
curl -O https://raw.githubusercontent.com/amitdugar/bamp/main/bamp-mysql.sh
curl -O https://raw.githubusercontent.com/amitdugar/bamp/main/bamp-uninstall.sh
# Make executable and use
chmod +x bamp*.sh
bamp 8.4
# Clone for development/contribution
git clone https://github.com/amitdugar/bamp.git
cd bamp
./install.sh # Install globally
# Or use directly: bamp 8.4
# Add to your shell profile (~/.zshrc or ~/.bash_profile)
export PATH="$HOME/path/to/bamp:$PATH"
# Create symlinks without .sh extension
ln -s $(pwd)/bamp.sh ~/bin/bamp
ln -s $(pwd)/bamp-vhost.sh ~/bin/bamp-vhost
ln -s $(pwd)/bamp-mysql.sh ~/bin/bamp-mysql
ln -s $(pwd)/bamp-uninstall.sh ~/bin/bamp-uninstall
To update to the latest version, simply re-run the installer:
# Download and install globally
curl -fsSL https://raw.githubusercontent.com/amitdugar/bamp/main/install.sh | bash
- πΊ Homebrew-powered - Clean, manageable installations
- π Apache (httpd) - Production-grade web server
- π Multiple PHP Versions - 8.1, 8.2, 8.3, 8.4 with instant switching
- ποΈ MySQL - Full-featured database server with professional configuration
- π΅ Composer - PHP dependency manager
- π§ phpMyAdmin - Web-based MySQL administration
- π Auto SSL - Trusted wildcard certificates via mkcert (
*.test
) - π DNS Resolution -
*.test
domains work automatically - π Virtual Hosts - Easy site management with SSL
- π§ Dev-Optimized - Error display, proper logging
- π Status Dashboard - Monitor all services
- π Service Management - Start, stop, restart with ease
- π₯ Import/Export - SQL and compressed SQL.GZ support
- πΎ Automated Backups - Timestamped, compressed dumps
- π Security Management - Password reset and configuration
- π§ Maintenance Tools - Optimize, check, and repair databases
- π Database Analytics - Size reporting and table statistics
- π Comprehensive Logging - Apache logs per virtual host
- πΎ Backup System - Safe configuration changes
- π― Dry-Run Mode - Preview changes before applying
- π§Ή Clean Uninstall - Complete removal with backups
- π Full Documentation - Detailed help and examples
BAMP provides a complete suite of professional tools:
Script | Purpose | Key Features |
---|---|---|
bamp.sh |
Core Installation | Install stack, switch PHP versions, service management |
bamp-vhost.sh |
Virtual Hosts | Create SSL-enabled sites, domain management |
bamp-mysql.sh |
Database Operations | Import/export, backups, maintenance, security |
bamp-uninstall.sh |
Safe Removal | Complete cleanup with backup options |
bamp.sh 8.4
What this does:
- Installs/updates Homebrew
- Installs Apache, MySQL, PHP, and dependencies
- Installs phpMyAdmin for database management
- Configures Apache with proper settings
- Sets up SSL certificate authority with wildcard
*.test
certificates - Configures DNS for
.test
domains - Creates default MySQL configuration
- Interactive MySQL security setup
- Creates sample PHP info page
# Interactive mode
bamp-vhost
# Command-line mode
bamp-vhost myapp /Users/yourname/www/myapp/public
Results:
- β
myapp.test
domain configured - β
HTTP:
http://myapp.test
- β
HTTPS:
https://myapp.test
(trusted SSL via wildcard certificate) - β Apache restarted automatically
# List all databases with sizes
bamp-mysql list
# Import a database
bamp-mysql import myapp production_backup.sql
# Export with compression
bamp-mysql dump-gz myapp backup.sql.gz
# Backup all databases
bamp-mysql dump-all ~/backups/
# Check service status
bamp --status
# List all virtual hosts
./bamp-vhost.sh --list
# MySQL status and configuration
./bamp-mysql.sh status
# Switch PHP versions
bamp 8.4
# Restart all services
bamp --restart
# Installation and PHP switching
bamp # Install with default PHP 8.2
bamp 8.2 # Install/switch to PHP 8.2
bamp --help # Show all options
# System management
bamp --status # Show service status
bamp --list # List available PHP versions
bamp --restart # Restart all services
# Create virtual hosts
./bamp-vhost.sh # Interactive mode
./bamp-vhost.sh myapp /path/to/public # Command-line mode
./bamp-vhost.sh -d local myapp /path # Use .local domain
./bamp-vhost.sh --dry-run myapp /path # Preview only
# Manage existing hosts
./bamp-vhost.sh --list # List all virtual hosts
./bamp-vhost.sh --remove myapp # Remove virtual host
./bamp-vhost.sh --help # Show all options
# Import operations
./bamp-mysql.sh import myapp backup.sql # Import SQL file
./bamp-mysql.sh import-gz staging prod.sql.gz # Import compressed file
# Export operations
./bamp-mysql.sh dump myapp # Export to timestamped file
./bamp-mysql.sh dump-gz myapp backup.sql.gz # Export with compression
./bamp-mysql.sh dump-all ~/backups/ # Backup all databases
# Database management
./bamp-mysql.sh list # List databases with sizes
./bamp-mysql.sh create newproject # Create database
./bamp-mysql.sh drop oldproject # Drop database (with confirmation)
# Service management
./bamp-mysql.sh restart # Restart MySQL
./bamp-mysql.sh reset-password # Reset root password
./bamp-mysql.sh status # Show MySQL status
# Maintenance
./bamp-mysql.sh optimize myapp # Optimize database tables
./bamp-mysql.sh check myapp # Check and repair tables
# Safe removal with backups
./bamp-uninstall.sh
# Advanced options
./bamp-uninstall.sh --dry-run # Preview what will be removed
./bamp-uninstall.sh --keep-data # Keep databases
./bamp-uninstall.sh --no-backup # Skip backups
./bamp-uninstall.sh --force # Skip confirmations
Service | Port | Location |
---|---|---|
Apache HTTP | 80 | http://localhost |
Apache HTTPS | 443 | https://localhost |
MySQL | 3306 | mysql -u root |
phpMyAdmin | - | http://localhost/phpmyadmin |
Document Root | - | /Users/yourname/www |
Custom Port Configuration:
# Use custom ports if 80/443 are in use
BAMP_HTTP_PORT=8080 BAMP_HTTPS_PORT=8443 ./bamp.sh
# Or for virtual hosts
BAMP_HTTP_PORT=8080 BAMP_HTTPS_PORT=8443 ./bamp-vhost.sh myapp /path
# Set for entire session
export BAMP_HTTP_PORT=8080
export BAMP_HTTPS_PORT=8443
export BAMP_MYSQL_PORT=3306
./bamp.sh
Why Standard Ports?
- β Professional URLs - Clean URLs without port numbers
- β Production-like - Matches real web server configurations
- β Team Friendly - Consistent across development environments
- β Flexible - Easy override when ports are occupied
# Apache
${BREW_PREFIX}/etc/httpd/httpd.conf # Main Apache config
${BREW_PREFIX}/etc/httpd/extra/httpd-vhosts.conf # Virtual hosts
${LOG_DIR} # Apache logs
# PHP
${BREW_PREFIX}/etc/php/8.2/php.ini # PHP configuration
${BREW_PREFIX}/opt/php@8.2/ # PHP installation
# MySQL
${BREW_PREFIX}/etc/my.cnf # MySQL configuration
${BREW_PREFIX}/var/mysql/ # Database files
# SSL Certificates
${BREW_PREFIX}/etc/httpd/certs/ # SSL certificates
~/.mkcert/ # mkcert CA files
BAMP creates a professional MySQL configuration with development-friendly defaults:
# /opt/homebrew/etc/my.cnf
[mysqld]
# Balanced sql_mode (removes STRICT_TRANS_TABLES for convenience)
sql_mode = "ONLY_FULL_GROUP_BY,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
# UTF8MB4 support
character-set-server = utf8mb4
collation-server = utf8mb4_0900_ai_ci
# Performance settings optimized for local development
max_connections = 200
innodb_buffer_pool_size = 256M
query_cache_type = 1
query_cache_size = 64M
To customize:
# Edit configuration
sudo nano ${BREW_PREFIX}/etc/my.cnf
# Apply changes
./bamp-mysql.sh restart
# Verify settings
./bamp-mysql.sh status
BAMP supports multiple PHP versions simultaneously:
# Install all supported versions
bamp 8.1 # Installs 8.1 and switches to it
bamp 8.2 # Installs 8.2 and switches to it
bamp 8.3 # Installs 8.3 and switches to it
bamp 8.4 # Installs 8.4 and switches to it
# Check what's installed
bamp --list
Supported PHP Versions:
- PHP 8.1 (LTS)
- PHP 8.2 (Active)
- PHP 8.3 (Active)
- PHP 8.4 (Latest)
BAMP automatically creates a wildcard SSL certificate for all .test
domains:
# All .test domains automatically get SSL
myapp.test # β
Trusted SSL
api.test # β
Trusted SSL
blog.test # β
Trusted SSL
# For custom domains, individual certificates are created
myapp.local # β
Individual SSL certificate
myapp.dev # β
Individual SSL certificate
# Use .local instead of .test
./bamp-vhost.sh -d local myapp /path/to/public
# Result: myapp.local
# Use .dev domain
./bamp-vhost.sh -d dev myapp /path/to/public
# Result: myapp.dev
# Migrate from production
./bamp-mysql.sh dump-gz production prod_backup.sql.gz
./bamp-mysql.sh import-gz local_dev prod_backup.sql.gz
# Daily backup routine
./bamp-mysql.sh dump-all ~/daily_backups/$(date +%Y-%m-%d)/
# Database maintenance
./bamp-mysql.sh optimize myapp
./bamp-mysql.sh check myapp
BAMP automatically configures PHP for development:
display_errors = On
error_reporting = E_ALL
date.timezone = UTC
MySQL is configured for development convenience:
- Relaxed
sql_mode
(removesSTRICT_TRANS_TABLES
) - UTF8MB4 character set by default
- Optimized buffer sizes for local development
Share your BAMP configuration with your team:
# Export virtual host configuration
cp ${BREW_PREFIX}/etc/httpd/extra/httpd-vhosts.conf team-vhosts.conf
# Export database schemas
./bamp-mysql.sh dump-all team-databases/
# Team members can import
cp team-vhosts.conf ${BREW_PREFIX}/etc/httpd/extra/httpd-vhosts.conf
bamp --restart
# Import databases
for db in team-databases/*.sql.gz; do
dbname=$(basename "$db" .sql.gz)
./bamp-mysql.sh import-gz "$dbname" "$db"
done
Port conflicts:
# Check what's using standard ports
lsof -i :80
lsof -i :443
# Use custom ports if needed
BAMP_HTTP_PORT=8080 BAMP_HTTPS_PORT=8443 ./bamp.sh
# Or edit Apache config manually
sudo nano ${BREW_PREFIX}/etc/httpd/httpd.conf
SSL certificate issues:
# Reinstall mkcert CA
mkcert -uninstall
mkcert -install
# Regenerate wildcard certificate
bamp # Wildcard cert is recreated during installation
# For individual domains
./bamp-vhost.sh --remove myapp
./bamp-vhost.sh myapp /path/to/public
DNS not resolving:
# Check dnsmasq status
brew services list | grep dnsmasq
# Restart DNS services
sudo brew services restart dnsmasq
sudo dscacheutil -flushcache
MySQL connection issues:
# Check MySQL status
./bamp-mysql.sh status
# Restart MySQL
./bamp-mysql.sh restart
# Reset password if needed
./bamp-mysql.sh reset-password
# Check configuration
sudo nano ${BREW_PREFIX}/etc/my.cnf
Database import/export issues:
# Check database exists
./bamp-mysql.sh list
# Verify file format
file backup.sql.gz
# Import with verbose output
./bamp-mysql.sh -v import myapp backup.sql
# Check for corruption
./bamp-mysql.sh check myapp
# Individual service control
brew services start httpd
brew services stop mysql
brew services restart dnsmasq
# Check service logs
tail -f ${BREW_PREFIX}/var/log/httpd/error_log
tail -f ${BREW_PREFIX}/var/log/mysql/error.log
# Test Apache configuration
sudo ${BREW_PREFIX}/bin/httpd -t
# Test PHP installation
php -v
# Check Apache virtual host configuration
sudo ${BREW_PREFIX}/bin/httpd -S
# View Apache error logs
tail -f ${BREW_PREFIX}/var/log/httpd/error_log
tail -f ${BREW_PREFIX}/var/log/httpd/myapp-error.log
# Test DNS resolution
nslookup myapp.test
dig myapp.test
# Check database sizes
./bamp-mysql.sh list
# Optimize slow databases
./bamp-mysql.sh optimize large_database
# Check for table corruption
./bamp-mysql.sh check problematic_database
# Monitor MySQL performance
mysql -e "SHOW PROCESSLIST;"
mysql -e "SHOW ENGINE INNODB STATUS\G"
/opt/homebrew/ # Homebrew prefix (Apple Silicon)
βββ etc/
β βββ httpd/
β β βββ httpd.conf # Main Apache config
β β βββ extra/
β β β βββ httpd-vhosts.conf # Virtual hosts
β β βββ certs/
β β βββ _wildcard.test.pem # Wildcard SSL certificate
β β βββ _wildcard.test-key.pem # Wildcard SSL private key
β βββ php/
β β βββ 8.1/php.ini
β β βββ 8.2/php.ini
β β βββ 8.3/php.ini
β β βββ 8.4/php.ini
β βββ my.cnf # MySQL configuration
βββ var/
β βββ log/
β β βββ httpd/ # Apache logs
β βββ mysql/ # MySQL databases
βββ opt/
βββ php@8.1/
βββ php@8.2/
βββ php@8.3/
βββ php@8.4/
/Users/yourname/
βββ www/ # Document root
β βββ info.php # PHP info page
β βββ myapp/ # Your projects
βββ .my.cnf # MySQL client configuration
βββ BAMP_Backup_*/ # Automatic backups
graph TD
A[Homebrew] --> B[Apache httpd]
A --> C[MySQL]
A --> D[PHP 8.1-8.4]
A --> E[dnsmasq]
A --> F[mkcert]
B --> G[Virtual Hosts]
D --> G
F --> H[Wildcard SSL Certificate]
H --> G
E --> I[.test Domain Resolution]
F --> I
C --> J[phpMyAdmin]
G --> J
G --> K[Your Web Applications]
I --> K
H --> K
J --> K
We welcome contributions! Here's how to get involved:
- Check existing issues
- Create detailed bug reports with:
- macOS version
- Homebrew version
- BAMP component versions
- Error messages
- Steps to reproduce
- Check discussions for existing requests
- Propose new features with use cases
- Consider backward compatibility
- Fork the repository
- Create feature branches (
git checkout -b feature/amazing-feature
) - Follow existing code style
- Add tests for new functionality
- Update documentation
- Submit pull requests
# Clone your fork
git clone https://github.com/yourusername/bamp.git
cd bamp
# Test in a VM or separate machine
# Make changes and test thoroughly
# Ensure scripts work on clean systems
- β macOS Ventura (13.0+)
- β macOS Sonoma (14.0+)
- β macOS Sequoia (15.0+)
- β Apple Silicon (M1, M2, M3+)
- β Intel x86_64
- Homebrew (installed automatically if missing)
- Xcode Command Line Tools (installed automatically)
- Administrator privileges (for system configurations)
- Minimum: 3GB free space
- Recommended: 8GB free space (for multiple PHP versions, databases, and projects)
- mkcert creates a local Certificate Authority (CA)
- CA is automatically trusted by system keychain
- Wildcard certificate covers all
*.test
domains - Certificates are only valid for local development
- Never use these certificates in production
- dnsmasq only affects
.test
domain resolution - DNS changes are local to your machine
- No external network traffic is modified
- Scripts require sudo for system-level configurations
- User data remains owned by your user account
- Homebrew installations use standard security practices
- MySQL configuration files have appropriate permissions
- Interactive security setup during installation
- Multiple authentication options (none, simple, custom password)
.my.cnf
files have restricted permissions (600)- System databases are protected from accidental deletion
- Database operations include confirmation prompts
PHP Performance:
; In php.ini
opcache.enable=1
opcache.memory_consumption=128
opcache.max_accelerated_files=4000
Apache Performance:
# In httpd.conf
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MySQL Performance:
# In my.cnf (already optimized by BAMP)
innodb_buffer_pool_size=256M
query_cache_type=1
query_cache_size=64M
max_connections=200
# Monitor Apache processes
ps aux | grep httpd
# Check MySQL performance
./bamp-mysql.sh status
mysql -e "SHOW PROCESSLIST;"
# Database maintenance
./bamp-mysql.sh optimize myapp
./bamp-mysql.sh check myapp
# Monitor file changes
brew install fswatch
fswatch /Users/yourname/www/
# Regular maintenance routine
./bamp-mysql.sh optimize myapp
./bamp-mysql.sh check myapp
# Analyze database sizes
./bamp-mysql.sh list
# Compress old backups
gzip ~/backups/*.sql
# Clean up old backup files
find ~/backups/ -name "*.sql.gz" -mtime +30 -delete
-
Export your databases:
# From MAMP /Applications/MAMP/Library/bin/mysqldump -u root -p database_name > backup.sql # Or export via phpMyAdmin
-
Note your virtual hosts:
# MAMP vhosts are typically in: # /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
-
Install BAMP:
./bamp.sh
-
Import databases:
./bamp-mysql.sh import database_name backup.sql
-
Recreate virtual hosts:
./bamp-vhost.sh myapp /path/to/public
-
List existing projects:
valet links
-
Install BAMP:
./bamp.sh
-
Recreate projects:
# For each projects from valet links ./bamp-vhost.sh sitename /path/to/project/public
-
Export database volumes:
docker exec container_name mysqldump -u root -p database > backup.sql
-
Note your port mappings and volumes
-
Install BAMP:
./bamp.sh
-
Import databases and setup matching configuration:
./bamp-mysql.sh import database backup.sql
Feature | BAMP | MAMP Pro | Laravel Valet | Docker |
---|---|---|---|---|
Cost | Free | $59-99 | Free | Free |
Multiple PHP | β | β | β | β |
SSL Support | β Wildcard | β | β | Manual |
Database Tools | β Complete | β | β | Manual |
GUI | CLI | β | CLI | CLI/GUI |
Resource Usage | Low | High | Low | Medium |
Customization | High | Medium | Low | High |
Team Sharing | β | Limited | Limited | β |
Clean Uninstall | β | β | β | β |
Native Performance | β | β | β | β |
Backup Tools | β | β | β | Manual |
Import/Export | β | Basic | β | Manual |
Maintenance Tools | β | β | β | Manual |
- π Initial Release - Complete LAMP stack for macOS
- πΊ Homebrew Integration - Clean, manageable installations via Homebrew
- π Apache Configuration - Production-ready web server with virtual hosts
- ποΈ MySQL Setup - Full database server with professional configuration
- π Multi-PHP Support - PHP 8.1, 8.2, 8.3, 8.4 with easy switching
- π§ phpMyAdmin Integration - Web-based database administration
- π SSL Automation - Wildcard certificates for *.test domains via mkcert
- π DNS Resolution - Automatic .test domain resolution with dnsmasq
- π Virtual Host Management - Easy site creation with SSL support
- πΎ MySQL Security Options - Interactive password setup (simple/custom/none)
- π΅ Composer Integration - PHP dependency manager included
- π Database Tools - Complete MySQL utility for import/export/maintenance
- π Service Management - Start, stop, restart, and status monitoring
- π§Ή Clean Uninstall - Safe removal with backup options
- π Comprehensive Documentation - Professional setup and usage guides
- π This README - Comprehensive guide
- π¬ Built-in help -
bamp --help
,./bamp-mysql.sh --help
- π― Examples - Included throughout scripts
- π Bug Reports - GitHub Issues
- π‘ Feature Requests - GitHub Discussions
- π€ Contributions - Pull Requests
- π§ Email Support - Available for teams
- π’ Custom Development - Enterprise features
- π Training - Team onboarding sessions
MIT License
Copyright (c) 2024 BAMP Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
BAMP is built on the shoulders of giants:
- πΊ Homebrew - The missing package manager for macOS
- π Apache HTTP Server - The world's most used web server
- π PHP - A popular general-purpose scripting language
- ποΈ MySQL - The world's most popular open source database
- π mkcert - A simple tool for making locally-trusted development certificates
- π dnsmasq - A lightweight DNS forwarder
- π΅ Composer - Dependency Manager for PHP
Special thanks to:
- π¨βπ» Shivam Mathur - For the excellent PHP Homebrew tap
- π’ The Homebrew maintainers - For keeping the ecosystem healthy
- π₯ The PHP community - For continuous language improvements
- ποΈ The MySQL team - For the robust database engine
- π All contributors - For making BAMP better
Made with β€οΈ for the PHP development community
β Star this project β’ π Report issues β’ π‘ Request features
Remember: Great developers deserve great tools. BAMP gives you the power of MAMP Pro with the transparency of open source and the completeness of enterprise solutions.
πΊ BAMP: The only local development environment you'll ever need.