DEV Community

Jason Lotzer
Jason Lotzer

Posted on

🚀 The Fastest Way to Spin Up Magento + Warden + Hyvä on macOS & Linux (Introducing mage-mirror)

If you’ve ever tried setting up a fresh Magento 2 environment — or worse, cloning a production store to debug something locally — you know the pain:

  • Long install times
  • Packages failing during Composer setup
  • OpenSearch errors
  • Warden mismatches
  • Missing PHP extensions
  • Admin login issues
  • Slow upgrade rehearsals

After years of repeating the same environment setup steps, I decided to automate the entire process into one tool:

** mage-mirror — a one-command Magento + Warden + Hyvä environment installer.**
GitHub: https://github.com/j-scriptz/mage-mirror

In under 2 minutes, mage-mirror sets up a complete Magento environment with:

  • Magento 2.4.x
  • Warden (Docker) stack
  • Hyvä theme (optional)
  • Sample data (optional)
  • Multi-store routing
  • Composer configuration
  • OpenSearch auto-fix
  • Admin auto-creation
  • Remote sync & cloning
  • Upgrade mode

Using it feels like this:

./_mage-mirror.sh
Enter fullscreen mode Exit fullscreen mode

…and bam — Magento is ready.

A quick gif showing _mage-mirror.sh in action and the results of the local Hyva theme installed

Below I’ll walk through the features, how it works, and why I built it.


Why Magento Local Development Is Still Too Hard

Magento is powerful… but heavy.

Local setup often involves:

  • Installing PHP + Composer + MySQL manually
  • Dealing with permission issues
  • Fixing OpenSearch
  • Waiting 20–40 minutes for Composer to finish
  • Reindexing
  • Troubleshooting crypt keys
  • Patching configs
  • Creating stores and scopes

If you work with Magento professionally, the wasted hours add up fast.

Hyvä makes frontend development dramatically faster, but the backend environment setup still bottlenecks teams.

I wanted a tool that solved this cleanly.


What mage-mirror Automates

mage-mirror is built for speed, repeatability, and zero frustration.

Here’s what makes it different:


1. One Command = Full Magento Environment

Just run:

./_mage-mirror.sh
Enter fullscreen mode Exit fullscreen mode

The script:

  • Installs Warden (if missing)
  • Creates a project via Composer
  • Sets up Magento 2.4.x
  • Configures URLs and scopes
  • Creates an admin user
  • Deploys static assets
  • Compiles DI
  • Fixes file permissions
  • Loads sample data (optional)

It’s everything you need with zero manual steps.


2. Hyvä Theme Auto-Setup (Optional)

Want Hyvä?

Just set:

INSTALL_HYVA=yes
Enter fullscreen mode Exit fullscreen mode

mage-mirror imports the Hyvä theme (via OSS composer mirrors), installs it, and activates it as the storefront.


3. Clone Existing Magento Projects (Local or Remote)

This is where mage-mirror shines.

You can clone:

  • Your production store
  • A staging environment
  • A client’s site
  • A QA snapshot

Using:

  • rsync
  • tar
  • Remote mysqldump
  • Local SQL dumps
  • Local env.php & config.php

Example:

USE_RSYNC_MAGENTO=yes
USE_REMOTE_DB_DUMP=yes
Enter fullscreen mode Exit fullscreen mode

You will have the store running locally in minutes — not hours.


4. Magento Upgrade Mode

Need to test an upgrade from 2.4.x → 2.4.y?

Set:

UPGRADE_MAGENTO=yes
UPGRADE_MAGENTO_VERSION=2.4.*
Enter fullscreen mode Exit fullscreen mode

mage-mirror will:

  1. Import your existing store
  2. Adjust Composer version constraints
  3. Run a full Composer update
  4. Run setup:upgrade
  5. Reindex + compile + deploy
  6. Patch configs where needed

This is a game-changer for developers who do maintenance work.


5. Multi-Store Routing (Preconfigured)

If enabled, mage-mirror automatically maps:

mage.test → Website A
app.mage.test → Website B
Enter fullscreen mode Exit fullscreen mode

It:

  • Updates /etc/hosts
  • Patches pub/index.php to set MAGE_RUN_CODE
  • Sets base URLs
  • Configures scopes

No manual steps needed.


6. OpenSearch Auto-Fix (No More “No alive nodes found”)

This error:

Could not validate a connection to OpenSearch. No alive nodes found.
Enter fullscreen mode Exit fullscreen mode

…is one of the most common Magento headaches.

mage-mirror automatically configures:

catalog/search/engine = opensearch
hostname = opensearch
port = 9200
prefix = magento2
Enter fullscreen mode Exit fullscreen mode

Then triggers a full reindex.

You never see the error again.


Quick Start

Clone the repo:

git clone https://github.com/j-scriptz/mage-mirror
cd mage-mirror
chmod +x _mage-mirror.sh
./_mage-mirror.sh
Enter fullscreen mode Exit fullscreen mode

You’ll have Magento running at:


Example Configurations

All settings live in:

_mage-mirror.config
Enter fullscreen mode Exit fullscreen mode

Quick Hyvä install:

INSTALL_HYVA=yes
WITH_SAMPLE_DATA=no
USE_EXISTING_DB=no
Enter fullscreen mode Exit fullscreen mode

Clone production store:

USE_RSYNC_MAGENTO=yes
USE_REMOTE_DB_DUMP=yes
REMOTE_HOST=myserver
REMOTE_PATH=/var/www/magento
Enter fullscreen mode Exit fullscreen mode

Upgrade mode:

UPGRADE_MAGENTO=yes
UPGRADE_MAGENTO_VERSION=2.4.*
Enter fullscreen mode Exit fullscreen mode

Who Should Use mage-mirror?

This tool is perfect for:

  • Magento agencies
  • Freelancers
  • Hyvä developers
  • Magento upgrade specialists
  • Contributors
  • Junior devs who need a one-click setup
  • Teams who want standardized local environments

If you touch Magento regularly, mage-mirror saves you hours every week.


Bonus: Free Hyvä-Compatible Subcategory Cards

During setup, you can auto-install the Jscriptz Subcats module:

→ https://mage.jscriptz.com/jscriptz-subcats.html

Great for storefront UX and Hyvä builds.


Want to Support the Project?

If mage-mirror saved you time, the best way to support it is:

Star the GitHub repo
Share this article
Submit issues or PRs
Help spread the word in the Magento community

GitHub: https://github.com/j-scriptz/mage-mirror


Final Thoughts

Magento development is complex — but local environments don’t have to be.

mage-mirror was built to eliminate the pain points that developers repeatedly run into, and to make spinning up or cloning a Magento store as easy as running:

./_mage-mirror.sh
Enter fullscreen mode Exit fullscreen mode

Top comments (0)