[{"data":1,"prerenderedAt":36},["ShallowReactive",2],{"GX563Otate":3},{"id":4,"slug":5,"title":6,"excerpt":7,"meta_title":8,"meta_description":9,"page_content":10,"featured_image":26,"fields":27,"tags":29,"published":32,"published_at":33,"created_at":34,"updated_at":35},"7df31f24-0238-42c6-8448-4d7d78fe5555","notes/setting-up-a-serious-local-magento-dev-environment","Setting up a serious local Magento dev environment","Pulling down a shared project, moving off a Mac onto Ubuntu and Valet for speed, the MySQL 8 import gotcha, and running multiple sites locally. Rewritten from 2021 to 2022 videos.","Setting Up a Serious Local Magento Dev Environment","Pulling down a shared project, moving onto Ubuntu and Valet for speed, the MySQL 8 import gotcha, and running multiple Magento sites locally at once.",{"blocks":11},[12,20],{"id":13,"data":14,"type":19},"24b3d7a8-26e2-4d84-83c2-145776eb54cb",{"url":15,"title":16,"provider":17,"subtitle":18},"https://www.youtube.com/watch?v=dIgMnm4jE-o","Using Linux Ubuntu as a Magento Developer","youtube","The original video this piece is based on.","video",{"id":21,"data":22,"type":25},"00d0240e-ee61-43d2-ab6f-4a16da54cbff",{"content":23,"maxWidth":24},"\u003Cp>This is rebuilt from a few videos I recorded between 2021 and 2022, when I was setting up Magento projects locally, moving my whole development machine from a Mac to Ubuntu, and getting multi-site stores running on my laptop. The version numbers in those clips are old now, but the way you set up a local environment, and the places it bites you, have not really changed. So I have rewritten the lot here as one guide rather than three dated tutorials.\u003C/p>\n\u003Cp>One thing up front. The single biggest improvement I ever made to my Magento setup was not a config flag or a caching trick. It was getting off a heavy graphical stack and onto something lean. Everything below comes from that lesson.\u003C/p>\n\u003Ch2>Pulling someone else's project down without losing a day\u003C/h2>\n\u003Cp>Most local setups do not start with a fresh install. They start with you cloning a repo a colleague began, and trying to get it running on your machine. The mistake people make is cloning the default branch and assuming that is the working state. It usually is not. Check out the branch the team actually develops on before you do anything else, because the master or main branch is often missing modules, theme files, or the composer state you need.\u003C/p>\n\u003Cp>From there the order matters. Clone the repo, switch to the develop branch, then run composer install so the vendor folder gets populated. Magento is mostly composer packages, so an empty vendor folder is normal until you pull them in. After that you import the database, set your base URLs to your local domain, and run setup upgrade. If you skip composer and go straight for the Magento commands, you get a wall of errors that send people down the wrong rabbit hole.\u003C/p>\n\u003Cp>A small thing that saved me real time over the years: keep aliases for the PHP versions you run. I had one project happy on PHP 7.3 and another that would only install cleanly on 7.4 because of composer conflicts. Rather than fight my system PHP every time, I kept short aliases pointing at each version so I could switch per project in one word. If you work across several stores on different Magento versions, this is not optional, it is how you stay sane.\u003C/p>\n\u003Ch2>Why I moved off a Mac and onto Ubuntu\u003C/h2>\n\u003Cp>I ran Magento on a MacBook Pro with MAMP for the best part of a decade. It worked. It also crawled. Deploying static content could take five minutes. A single page refresh with cache off was slow enough that you lost your train of thought waiting for it.\u003C/p>\n\u003Cp>Switching to an Ubuntu laptop with Valet Linux changed that completely. Static content deploys dropped to a few seconds. Refreshes were close to instant even with the main cache off. The speed is not magic, it is just that you are no longer paying the overhead of a heavy graphical stack sitting between you and the machine.\u003C/p>\n\u003Cp>The instinct everyone has when they move to Linux is to recreate the comfortable setup they had before. Do not. I tried the all-in-one bundles like XAMPP and a few graphical control panels, and honestly they were not worth it. The strength of Ubuntu for this work is its simplicity and leaning on the command line. If you are a Magento developer you are going to be living in the terminal anyway, so this is a good habit to build, not a tax to avoid. Strip the machine back, run something lightweight, and let it be fast.\u003C/p>\n\u003Ch2>The MySQL gotcha that catches people moving machines\u003C/h2>\n\u003Cp>Here is the one that ruins an afternoon. When you set up a fresh Ubuntu machine, you very likely land on MySQL 8. If you are importing a database that was built on MySQL 5.7, which a lot of older Magento 2 stores were, you hit errors on import. The classic ones show up on time and date fields, where the stricter default handling in MySQL 8 rejects values that 5.7 waved through.\u003C/p>\n\u003Cp>You can work through it, but you need to know it is coming before you copy a 5.7 database across and assume it will just load. Check the MySQL version on both ends first. If you are migrating a real store, sort the data types and default values in the dump rather than fighting the import one error at a time. Knowing the version mismatch exists is most of the battle.\u003C/p>\n\u003Ch2>Running multiple sites locally\u003C/h2>\n\u003Cp>Once your single store runs cleanly, the next thing most of us need is multiple sites on one machine, usually so you can work on two different themes or two clients without tearing the environment down each time. Setting up a multi-site in the Magento admin is well documented, so I will not repeat it. The part people get stuck on is making it work locally across two real domains.\u003C/p>\n\u003Cp>In the admin you create a separate website, store and store view, rather than an extra store view under the existing site, if you genuinely want two independent domains rather than two languages of the same shop. That distinction trips people up. A French version of one shop is a store view. Two separate domains is two websites. Once the website exists, you point your local host setup at the extra domain so something like yourstore.test and another.test both resolve, and you set the run type and run code so Magento knows which site to serve on which domain.\u003C/p>\n\u003Cp>I do this with Valet Linux, but the same principle holds on MAMP or anything that gives you proper local hostnames. The local tooling changes, the Magento side does not.\u003C/p>\n\u003Ch2>Why I bother saying all this\u003C/h2>\n\u003Cp>None of this is glamorous, but a slow or flaky local environment taxes every single thing you do all day. Getting it lean is the highest return setup work there is. It is also, if I am honest, part of why I drifted away from this stack in the end. The amount of environment wrangling Magento asks of you before you write a line of feature code is a lot, and it is one of the threads in \u003Ca href=\"/notes/why-i-moved-from-magento-to-headless\">why I moved from Magento to headless\u003C/a>. If you are still in the Magento world though, do yourself the favour: go lean, learn the command line, and stop waiting five minutes for static content.\u003C/p>","lg","wysiwyg","",{"author":28},"Headless Digital",[30,31],"magento","dev-workflow",true,"2026-07-06T08:00:00+00:00","2026-06-15T09:56:18+00:00","2026-07-06T08:00:01.483966+00:00",1783324846295]