Moving a live WordPress site to a MAMP Pro custom local host is something WordPress Mac developers are going to need to do sooner or later.
(If you’re going from local to a live server, see this post)
There are tutorials, some are generally helpful, but after reading them, and 7 hours of trial and error, having to reinstall MAMP Pro three times, and having just about everything possible go wrong, I have some experience to share on how to do this.
The particular conditions I’m confronting, vs what I read about in tutorials about a single local site in MAMP, are as follows:
- I expect to need to do this again, so I need MAMP Pro’s multiple host and custom naming capability
- I’ll need multiple local dev sites
- I’ll have to cope with SSL – I’ll be taking all my sites that direction from this point.
Step one – Use Duplicator to Export the Live Site
The WordPress plugin Duplicator is a terrific tool. The defaults work pretty well. You don’t have to fill in the database info when creating your package – you get another shot at those fields during the local install process (see the callout – you will need them!). Download the install file and the archive, and put them in your local site-directory-to-be.
Step Two – Set up the local site in MAMP Pro
You could do this step first. (The order of these first two steps doesn’t matter.)
Checklist – collect this, or create it – before you start.
- database name
- database user name
- database user password
- local url
- local directory pathway
- Create a host in MAMP Pro.
- Set the host’s directory to your local site’s folder.
- Create a database.
–>Copy the name into a text document in your code editor – keep it handy.
- At the bottom of the window of the Database tab are buttons that open phpMyAdmin and Sequel Pro. Open Sequel Pro.
- Open the database with the dropdown in the upper left of the Sequel Pro start window.
- Add a user. Make sure you go to the second tab in the user screen (Global Privileges) and check all.
—>Save a note of the name, and put it into your text document with the database name.
- Give the user a password.
—>Save a note of it as well… you’ll be using these three items to connect WordPress to the database when you run the Duplicator installer.
- You’ll use your new local hostname in the url. The Duplicator installer will sniff it, and your new url will show up in the Duplicator installer options screen. You may also want to verify the local file path, although Duplicator does a good job with this as well.
To get your local file path, in the Finder, right- or control- click on the folder to get info, and press the option key to see “copy [folder name] as path”. Copy it, and save a note of it with the other information you’ll need.
Are you using SSL?
If so, now’s the time to create a self-signed certificate (see the documentation here). Store it locally.
(I had things fail and break bad before I took this step, trying to create a local copy of a live site that uses SSL).
Step Three: It’s time to run the Duplicator installer.
I’ve seen some horribly inadequate tutorial about this step, and it cost me many hours to find the solution.
They say “open the file install.php in a browser.” That’s easy for YOU to say… the browser didn’t see it, wouldn’t open it, and I had absolutely no idea what URL to use to try to locate it, and there was no information ANYWHERE.
Here’s what you do..
- In the “Apache” tab in MAMP Pro, check “indexes.” After you do that, you’ll see a file list in the browser when you hit the little “go to directory” arrow.
- There’s your installer file! You should also see your archive listed. (don’t open it – the installer will take care of everything).
- Click “install.php”. Your Duplicator installer will start to run.
- Enter your database information. Use the “check database” button, verify you have a connection to the database. Let it overwrite your database in case you already put something in there (back everything you might need up first!)
- Double check your URL and local file path.
- Login with your WP credentials from the live site. Run the cleanup tools at the prompts.
And there you have it.