How to Sync Windows and Mac for WordPress Development

I've recently bought a Macbook Pro 13" for development when I'm not sitting at my desk. This is my first experience with Apple and till now I'm delighted with my Macbook. Since I still use Windows on my desktop system, one of the first things I needed to do was to find a way to sync my desktop environment with my mobile (Macbook) environment. I will be showing you how I achieved this in today's tutorial.
Table of Contents

Sponsored Ad

If you purchase through a link on our site, we may earn a commission.

I’ve recently bought a Macbook Pro 13″ for development when I’m not sitting at my desk. This is my first experience with Apple and till now I’m delighted with my Macbook.

Since I still use Windows on my desktop system, one of the first things I needed to do was to find a way to sync my desktop environment with my mobile (Macbook) environment. This means that if, say, I’m developing a plugin at my desktop (Windows), then want to head over to continue work at a nearby coffee shop, I can grab my Macbook and continue development there painlessly.

Since I know there are others who have a similar setup, such as plugin developer Pippin Williamson, I’m going to outline the steps to get your Windows and Mac systems synced for WordPress development. I guess it will be useful for those of you out there who want to attempt something like this.

I will not be attempting to sync databases, because there doesn’t seem to be any reliable way to do this, and any solution I found also had considerable challenges which actually put me off even trying to implement DB syncing. The best thing to do with databases is to simply keep different databases, or else export and import when required. I would have loved to be able to sync everything, but I wanted the process to be easy and no straightforward solution could be found really.

So here we go, we only have 3 steps to have our Windows and Mac environments synced together for development:

Step 1: Have MAMP and XAMPP Set up and Running

I’m going to assume that you have already set up MAMP on your Mac and XAMPP on your Windows system. There are many guides out there on how to do this, and it’s pretty straightforward.

Test the setup in your browser by typing http://localhost.

Works? Brilliant, move on to the next step…

Step 2: Download and Install Dropbox

We will be syncing files using Dropbox, so go ahead and install it on both your Mac and Windows systems.

Haven’t used Dropbox yet? It’s an amazing file sharing/syncing application with a web interface to boot. Read more about Dropbox in Appstorm’s review, this is one tool you can’t afford to miss. Create one Dropbox account and make sure both your Mac and Windows Dropbox installations are using the same credentials and are working fine, then head over to the next step.

Step 3: Moving the htdocs Folder

Here’s where things get interesting. The idea is that we will be sharing the htdocs folder used by XAMPP and MAMP via Dropbox. Thus whenever changes are done while working on Windows, they are automatically propagated to your Mac, and vice versa. Naturally, we are assuming that both systems will be connected to the internet for this to work. As an added bonus, you will also get a third backup copy of your files stored on the Dropbox servers.

On Windows, there is a command that will enable you to make a link from your XAMPP folder to the htdocs folder within Dropbox. This command is mklink, and this is the syntax format:

[php]mklink /J X:\Path\to\hardlink Y:\folder\link\points\to[/php]

So in our case, just go to Start > type ‘cmd’.

Now cut your htdocs folder from the XAMPP folder and paste it into your Dropbox folder. It’s a good idea to backup the whole XAMPP folder before in case something goes wrong. You should have been backing up things anyway prior to this operation, always a good idea to backup your development folder.

Then with your command prompt open, enter the mklink command. That will probably look similar to this:

[php]mklink /J D:\xampp\htdocs C:\Users\username\Documents\My Dropbox\htdocs[/php]

Congratulations, you’ve just created a junction point. This means that when XAMPP goes looking for the htdocs folder it will be redirected to the folder within Dropbox. Everything works as before as all this happens virtually. It’s a very neat solution.

On Mac the process is easier, as you can easily change the location of the htdocs folder.

Within the settings of MAMP Pro (or MAMP), head over to the Apache section and select the Dropbox htdocs folder as your document root. Restart the server and you’re done.

Have you achieved the same thing using a different method? Let us know in the comments section below, we’re always on the lookout for better ways of achieving a goal.

If you enjoyed this post, make sure to subscribe to WPMayor’s RSS feed.

Jean Galea is an investor, entrepreneur, and blogger. He is the founder of WP Mayor, the plugins WP RSS Aggregator and Spotlight, as well as the Mastermind.fm podcast. His personal blog can be found at jeangalea.com.

Sponsored Ad

If you purchase through a link on our site, we may earn a commission.

All suggestions are anonymous.

More from our blog...

5 Responses

  1. The only way I have ever got this to work was having my WP address set to https://localhost:port. However, to test on mobile, I need the address to be my IP number. Any work arounds for that?

  2. Anyone tried Mamp for Windows yet? Would be interesting to see if dropbox could be used to synchronise Mamp on both Mac and Windows.

  3. With Mamp you can move the db folder to Dropbox and replace the original with a symlink (alias wont work). I use this mac-to-mac. How that is done on the Windows side I don’t know, though.

  4. To solve the problem of Sync the DB you can use one of the free services of MySQL in the Cloud.

Post a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Stay updated with WP Mayor's newsletter showcase every week

Stay on top of every new WordPress innovation and latest launches. Receive all our fresh product reviews and expert guides directly in your inbox.

Hosting Survey 2024

Are you happy with your hosting provider or are you over-paying for too little? Have your say below!

"*" indicates required fields

What's the main reason you picked this host?*
How happy are you with your host?*

OPTIONAL: If you'd like to receive the results of this survey, please enter your details below.