« Winters coming, WrapUp! Bullet Proof CMS record ordering pattern »

Initially I used dropbox, as an alternative to email, to share music tracks and ideas with band mates. So simple even our singer could work it out! It has quickly become my main tool for syncing all sorts of other data.
So I decided to see if it could be used to sync multiple MAMP web development environments. Site files and MySQL databases.
Ok, skip the blah, show me the method!
When you work on multiple computers it can be a pain to keep things in sync. But, where there’s data there’s a way to sync it with dropbox. One of the first dropbox solutions I came across was for 1Password, my password manager of choice. 1Password holds all its data in a keychain so you can simply move the 1Password.agilekeychain file to your dropbox and edit preferences in 1password to point to the new location. A more detailed tutorial can be found over at WebWorkerDaily. As of version 3, this keychain file can also be opened as an HTML webpage so you can access your passwords on computers without 1password installed.
Things requires a different approach. There is no preference option to chose the location of you data file. Instead you can move the Things data folder into your dropbox and create a symbolic link in its place. Detailed instructions can be found at this hocuspokus.net. Symbolic links are basically low level Aliases. I also use a similar method to keep the address book app in sync.
After using dropbox to sync these apps between 3 computers I was in need of a better way to sync my web development projects. I was already using dropbox to share zipped versions of site files and mysql dumps but this process was a bit tedious. Every morning I have to unarchive the files into my sites folder and re-import databases and remember to export them before I left. One solution would be to create a couple of scripts to import and export this data… but after seeing how well dropbox had worked so far, I decided to test its limits and sync a whole web development sever.
I use MAMP to run my local webserver with php and mySQL. The first step is to sync Apache’s webroot. By default it’s located in the /Applications/MAMP/htdocs folder.
Click Preferences > Select the Apache tab and change the location to a folder in your dropbox, I use /Dropbox/Sites.

Now all your development site files will be kept in sync through your dropbox.

The second step is to sync MAMPs MySQL server. Unfortunately MAMP does not provide the option to define the location the database files are kept. So I followed the symbolic link method used to sync Things.
MAMPs database files are stored in /Applications/MAMP/db. Make sure you quit MAMP first, then move the db folder to your dropbox.
Create a symbolic link back to its original location. You can use terminal for this but I prefer to use SymbolicLinker a contextual symlink plugin. It gives you a “Make Symbolic Link” option in any file or folders right click menu.
Thats it, you’re done. Start up MAMP and you’re up in the cloud.
I haven’t tested this process fully yet and may update this post if I see any trouble brewing. A few points to note though.
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
I’m trying to set up my db folder on dropbox, but I can’t get them to sync. The other macs on my network are seeing the old database.
Weird…
I’ve had a few odd occasions where it appears I have a completely different databases on each computer even though they are both pointing to the same db folder… When I get the time i’ll investigate but must admit I haven’t a clue at the moment!
If you are using MAMP PRO, the db folder is located here: /Library/Application Support/appsolute/MAMP PRO/db
This is a great article guys – really helpful!
Oh, and thanks for signing up for LiveStats. It’s a pleasure to have you on board.
Cool idea! I think you would be interested Osmek, a cloud based cms with an API. Check them out http://osmek.com
Awesome post, it’s a really big help. Quick question though… Is dropbox actually needed to make all this happen? Couldn’t you just set a directory on one of your macs as public, and then follow the rest of your steps based on that public directory to be accessed from any computer on your network? Would you get the same result?
I’m trying to setup in my house so I can jump on different computers and work on developing the same WordPress sites all on teh same internet connection, obviously. So, I’m just trying to figure out what the most practical approach would be.
If your second system is Linux, here’s a trick to make sure your unix-paths are the same on both machines:
Make a symbolic link (not an alias) on your Mac, in the root folder (/), pointing to your htdocs folder.
Using the same method and name of the symbolic link on your Linux machine, pointing to It’s htdocs folder, simply share that folder over Dropbox, and your good for sharing.
$ ln -s /Users/me/htdocs /htdocslinkIf set up corr. you now have the unixpath you can use, ex.
Thusly, you can wirror your work hassle-free
on both computersSadly, it seems pretty much impossible to share a mysql database the same way, since mysql on linux is barely read-only.
Interesting. I’ll have to play around with this. I don’t know how well this will work if you are using some really slow wireless at a bar or something, but it seems like a cool idea.
[...] and make a symbolic link. Move the link back to the MAMP folder and dunzo! An excellent tutorial HERE (also where I got the pic [...]
There is a problem with all this syncing db with dropbox.
the folder stock syncing because mamp close permissions automatic. and you need to give the folder permissions everytime you update.
I’m not interested in write permissions
for anything other than OSX
So
Would this at all be possible with osx as the
main db editor & testing via Parallels virtual installs of
XP-iE6, XP-IE7, Win7-IE8 … etc?
I’ve been experimenting with this setup (using Mamp-Pro) for about a year. Problem is that if you’re connected to the internet, via say… dyndns, you need to be using www/mysql (user) in Mamp pro. This is a problem as it does not allow you to use Dropbox/htdocs… I’ve suffered long!
[...] to figure out a way to synchronise my local WordPress databases with across multiple computers with StuckTogetherWithTape on how to do this and I’ll walk you through this method in the video. Even if you don’t [...]
I’ve got the MAMP htdocs folder syncing with Dropbox, and now I can create PHP pages on my iMac, and see them instantly on my Macbook Air (once they’re saved). So that’s awesome!
However, I can’t seem to get the database symlink to work. I’ve shut down MAMP, copied my MAMP/db folder to Dropbox, and right-clicked on that db folder to create a symbolic link. However, that linked folder doesn’t have any contents (the mysql and sqlite folders are missing). So when I move the symlinked db folder to my MAMP/* directory it remains empty and my MAMP MySQL server shows a red light (instead of green).
Any ideas why the symlinked db folder is empty?
I haven’t tried using terminal to create the symlink because I’m not familiar with terminal. I tried following the terminal code that was shown on hocuspokus but I wasn’t exactly clear on what I needed to change to make the code work for MAMP (since the code is written to create a symlink for a Things database).
Alright, it turns out that I needed to restart Dropbox before it would properly sync my db folder. Now the db folder contains the proper subfolders (/mysql and /sqlite). However, changes to the databases don’t seem to show up properly.
For example, I created a new database (test_db) and created a new table within that database (test_table). When I switched to my other computer the database (test_db) showed up and it said that it had one table, but the table (test_table) didn’t appear. So I created a second table (tbl_2) and refreshed the database. Now the database showed that it had 2 tables, but only tbl_2 was showing up on the second computer, and test_table was still showing up on the first computer (but no tbl_2).
However, stopping and restarting the MAMP servers on both machines seemed to fix the issue (now test_table and tbl_2 both show on both computers). Is this normal behavior? It would be better if I didn’t have to remember to restart my MAMP servers every time I switch machines. That’s just another step to accidentally forget.
Thanks in advance!