Simon Davies Digital ltd

Syncing MAMP with Dropbox

Posted by & filed under MAMP.

I use MAMP as my local development environment. MAMP is brilliant as it installs the software (Apache, MySQL and PHP) used to run a web server similar to a LAMP server. This is great as it means you can test your files locally without having to upload them first. As I work between a MacBook and an iMac I was looking for a away to keep my projects in sync between the 2 machines. I turned to Dropbox which is a service that synchronises a folder on your computer over the internet.

I created a directory called sites in my Dropbox folder and then added my projects in here. All my projects are now sync’d on both machines but if I make any changes to the Database I’ve got to do this on both machines. You can use Dropbox to sync your databases as well. This isn’t the most ideal solution as you can run into some problems, especially if are running both versions of MAMP simultaneously. I’ve been using this solution for about a year now and not run into any major problems so until I find a better way I’ll continue to do so.

To sync your database you will need to move the MAMP db folder to dropbox and then create a symbolic link in the MAMP folder back to the db folder in the dropbox. Before starting make sure your MAMP servers are turned off, then open up terminal and enter.

cd ~/Dropbox/
cp -r /Applications/MAMP/db MAMP_DB
rm -rf /Applications/MAMP/db

This will change the directory to your Dropbox folder, then copy the MAMP db folder to dropbox and remove it from the MAMP directory. Then we have to setup the symbolic link.

ln -s ~/Dropbox/MAMP_DB/db /Applications/MAMP/db

Passing the -s option to the ln command will create a symbolic link, we then pass source file and the target file. And that’s it, restart your MAMP servers and you should be syncing your databases to Dropbox. You will need to run the last 2 commands on any other computers you have MAMP installed.

If two of your MAMP installs update the same file at the same time, the 2nd to finish will not overwrite the existing file it will instead create a conflicted file, to fix this you just need to determine which file has the correct data and delete the other (removing the conflicted message in the file name).

This can cause some problems with your MySQL databases, if you are noticing missing data this is the first place to check. You should keep an eye on the ~/Dropbox/MAMP_DB/db/mysql folder, especially the ibdata1 file as this can be quite large and having multiple copies of this file can quite quickly use up all your of Dropbox space.

  • Mike P.

    Hi Simon,

    Thanks for this – it was just what I needed to get done. 2 quick things with the code that you might want to update for others through. Line 2 needs the recursive flag so should be cp -r /Applications/MAMP/db MAMP_DB and line 4 you want to link the directory you created within MAMP_DB like: ln -s ~/Dropbox/MAMP_DB/db /Applications/MAMP/db
    Thanks again for putting me in the right direction!

    • Simon Davies

      No problem Mike!
      Thanks for pointing out those 2 corrections, I’ve updated the post for future readers.

  • Leighton

    Hi there,
    I have just done the above and managed to install wordpress as a test.

    My question is:
    When you create a new post in wp. should the dropbox icon immediately start syncing? I have been making test updates and no syncing has happened.

    I have a ib_logfile0 , ib_logfile1 and the ibdata1. My ibdata1 is 18.9mb. I they are filled with garble. Do I need to delete one?

    • Simon Davies

      Hi Leighton,

      I wouldn’t delete one of these files as they hold the structure of your MySQL install. Has Dropbox created a conflicted file?

      Have you checked if the file is being uploaded to Dropbox by looking at your account online?

      • Leighton

        Thx for your reply Simon. Nah definitely not a conflict file after reading that link. I understand that now. My concern was with small text changes. The wp-posts doesn’t show that it has updated when looking at the dropbox events. When it adds an image it updates straight away as it’s obviously syncing the photo to the folder. I wouldn’t think that the change has to be a certain amount would it? I’m syncing a few sites between three people. Seems abit fiddly doing it this way but thought I would see what dropbox is capable off. Will test it with a mate to see if they are being synced to him. Cheers.

  • Stephanie

    Hi Simon,

    I set this up on two computers and immediately got two conflicted ibdata1 files on the new computer.

    Now, the new computer has a ton of missing tables in phpmyadmin.

    Everything is still working on computer #1. Any idea how to fix this?

    • Simon Davies

      Hi Stephanie,

      Sounds like you could have had MAMP running on computer #1 while setting up #2.

      To fix I would first make sure both versions of MAMP are turned off. Then on computer #2 first make a backup of ib_logfile0 ib_logfile1 and ibdata1, just to be safe. Then find the conflicted files from computer #1 (the computer name should be in brackets) and rename these to original file name (ibdata1 etc.)

      Then restart MAMP on computer #2 and all your tables and data should be back.

      It’s really important to make sure you don’t run both versions of MAMP simultaneously as you can lose data.

      • Chase

        Thank you Simon. I was struggling to figure out why Dropbox was creating conflicted files. In fact I was running both instances of MAMP from both machines. I am no longer getting conflicted files. Will find out for sure when I get to the office tomorrow. Thanks again. 2 years later this post is still helping people.

        • simonda86

          Glad it helped 🙂

  • Hi Simon

    That’s exactly what I was looking for. Unfortunately, after doing what you’ve desriped above my local servers doesn’t start up again. (Nor the Apache or MySQL.) If also tried to change the Document Root for the Apace to the htdocs in the Dropbox folder. Nothing.

    I see the linked file for the db folder in the “native” MAMP folder, so that worked so far.

    Any idea what to do?


    • simonda86

      Hi Felix,

      When MAMP won’t start this is usually because of a Apache configuration error, check the apache error logs and this should point you in the right direction.

      You can also use ‘apachectl configtest’ to check the apache config file but its worth making sure that you’re checking the right version of apache first as Mac OSX does come with apache preinstalled. Do this by running ‘which apachectl’

      Hope you get it sorted!

  • voltronik

    Just thought i’d mention that the last line (ln -s ~/Dropbox/MAMP_DB/db /Applications/MAMP/db) doesn’t need the ‘db’ at the end. It should just read, ln -s ~Dropbox/MAMP_DB/db /Applications/MAMP. Otherwise it will put the db symbolic link inside MAMP’s original db folder.

    • Katrina Isabelle

      Thank you so much – it wasn’t working for me after I followed the tutorial in the blog post, but works after making this modification.

      OP – please update the original blog post with the correct symlink!

  • Simon, this worked perfectly! However I did exactly what @voltronik:disqus did, don’t add “/db” after Applications/MAMP and now my macs have the same database synced throughout. Thanks again! This was a livesaver!

  • Is there a reason why we can’t just put the whole MAMP app folder inside of dropbox and use selective sync to synchronize the HTDOCS and DB folders? The files which won’t be edited in the app folder don’t need to be synced and each machine can have their own local static version.

    • simonda86

      Hi Matt, As far as I’m aware this is would not work as when you deselect a folder from dropbox the files will be removed from your computer. Have a look at this from Dropbox

      • Hi Simon, i’ve had a read of the link you gave and your point makes sense. Though i have to say in practice this doesn’t seem to be happening. I’ve been using MAMP in this way across 2 machines for several days and it hasn’t removed the folders. I’m just seeing a grey ‘-‘ symbol next to the folders that have been deselected.

        • simonda86

          Oh ok, that’s interesting if it isn’t removing the folders on your computer and not using up your dropbox allowance then I see no reason why you can’t use this method. You again will need to watch for conflicted files as they can use up a lot of space on Dropbox.

  • Luan

    Hey Simon, thanks for posting this. How do you unlink a computer if you don’t want that computer to sync anymore?

  • ashancock

    Thank you for this! Was the perfect solution for what I was trying to do.

  • Alan Shortis

    Thanks for this post – I was following a tutorial elsewhere which caused the linked db folder in MAMP to be in a sub folder, which meant the MySQL server could not start. Fortunately I found this before tearing out my remaining hair.

  • Diego Santamarta

    Thanks for the solution Simon, I did it first on my MacbookPro and works fine, but after in my iMac it works for static pages (no db) but for the other ones i get a 500 error. I’ve tryed many things and nothing works, I looked into the console log and nothing.

    Any idea?

    • simonda86

      Hi Diego, 500 errors could be any number of things really. Is there nothing in MAMP php error logs? A 500 is likely to be a error in the mamp setup. Is the mysql server starting up, can you access phpmyadmin?

  • This works great for MyIsam tables, but will be a complete disaster for InnoDB tables for obvious reasons.

    • Sean Michael

      Hey Andres, can you elaborate on this a little for some of us less back-end savvy people. I just changed to this set up and have noticed some issues and think they may be related to the InnoDB tables. The mysql error log in MAMP is continually notifying me of an InnoDB error.

      • Exactly what I was trying to warn. Check your ibdata0 and ibdata1 files, perhaps Dropbox had problems while syncing those.

        • Sean Michael

          Thanks for the response. It seems like ibdata1 is synced fine, but I don’t see any ibdata0. I did notice that there is a problem with the ib_logfile0 in dropbox and it is displaying a red “x” icon. I might just revert back to my old way of doing things if there is no way around the errors.

          • When using innodb there is more than just the .frm files (MyISAM tables). You’ve also got ibdata1, ib_logfile0 and ib_logfile1 (sorry, I posted ibdata0 as well in my previous comment). Dropbox pool-syncs the files, and since they directly related, it might screw things up. Restoring an InnoDB table is not easy neither. Check out some solutions at stackoverflow.

          • Sean Michael

            I’m not even sure which sites database needs to be restored, because I moved my localhost folder (about 20 sites) into dropbox. I think I’m just going to say screw it, and pull everything back down from dropbox and use the old setup. It’s too much to risk, while working on some big projects (hopefully none of these were corrupted). Gracias por la ayuda, compa!

          • Ben

            hey do either of you guys know if your typical wordpress install uses innodb tables? I’m thinking of trying this syncing method…

          • simonda86

            Hi Ben, innodb and MyISAM are different types of storage engine and WordPress will use whatever is the MySQL default so will be able to run on both. There are both advantages and disadvantages with both. Have a look at

          • Ben

            thanks. it sounds like it’s myisam as the default, which is fine by me.

  • Pingback: Installing Xampp and syncing using dropbox on multiple computers | iheartpinkandturquoise()

  • daniel crabbe

    Does this sync the servers & settings too or just database content?

    • simonda86

      This sync’s your database and all the files in you htdocs folder, what settings did you mean?

      • daniel crabbe

        The actual hosts and their aliases etc.

        • simonda86

          The hosts are stored in the /etc/hosts file, you can try moving the hosts file to dropbox and creating a symbolic link to the file in the /etc directory, I haven’t tried this but in theory this should work.

  • Thanks for this, very useful. One note. If you are using MAMP Pro, your database is located in /Library/Application support/appsolute/MAMP Pro not in your Applications folder.

  • Katie H

    Brilliant, this works exactly as outlined.

  • brianmaierjr

    Hey Simon. I just followed the tutorial because I really want to do this but now my SQL server won’t start. I can see the errors in the log but I’m not getting much further than that. Any suggestions? Thanks for the post btw.

    • simonda86

      Hey Brian, what errors are you getting? Have you checked that a version of MySQL isn’t already running as if the port is already in use then the server won’t start up?

  • D.M.

    This no longer works for me in Yosemite. MAMP keeps complaining about not being able to connect to the socket. If I replace the symlink to the Dropbox db with the actual db folder it works….

    • Same problem here, I keep on getting these errors:
      [ERROR] Fatal error: Can’t open and lock privilege tables: Table ‘host’ is read only
      150424 16:13:27 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/ ended

    • Have you resolved the issue?

  • Pingback: My Two Computer Setup | Pautler Design Blog()

  • Kurt Blom

    I tried this workout on recent OS X (El Capitan) and Mamp Pro versions (3.4) and everything just works like a charm. If you want to keep your mysql tables synced to, you have to store them on your dropbox too: I mentioned that a user’s mysql tables are kept in /Libraries/Application Support/appsolute/MAMP PRO/db/mysql/ (1).
    So I created an extra folder ‘mysql-data’ into the MAMP_DB folder on Dropbox, where I put the content of (1). Creating symlinks in the same way described in this article keeps all tables synced on different development machines.

    • I too am running El Capitan and I can’t get this to work. In spite of a successful move-and-link, as verified in Finder, I simply can’t get MySQL to launch. Are there some further settings either in the OS or in MAMP that I may have missed?

      • Quick follow-up: I’m still having trouble getting it to work across my second computer. The listings appear for my sites, but each is linked to the directory of my main computer, complete with its own volume names. In other words, setting up the directory outside of the default location ~/Dropbox/ will cause problems. In addition, you’ll need the user to have the same name so that the settings will reference the same home folder name.

        Still banging on it.

  • There is a Mamp Pro public beta with dropbox sync:


Want to hear more about Simon Davies Digital and what we can do for your business or simply want to say hello, then get in touch.

+44 7846 400933