How to backup your projects in MAMP using Dropbox
Its always a good idea to keep a backup of your projects. Your projects are your hard work after all.
There are other tools like SVN, GIT, etc., these tools have their own benefits but dropbox is comparatively easy to setup and use.
Step 1
You need both MAMP and Dropbox installed on your Mac. (If needed you can find instructions to install both applications on their respective websites.)
Step 2
Change document root in MAMP settings. Document root is the path where your project files are stored. (Default path is /applications/mamp/htdocs/)
You can simply create a new folder for your projects in dropbox and move your existing files from htdocs folder to this newly created folder in dropbox.
Next you need to change document root in MAMP settings.
If you are using free version of MAMP:
- Open MAMP
- Click on Preferences
- Go to Web Server tab
- Click on folder icon to change document root, select the folder you have created in Dropbox
- Click Ok, to close preferences
- If Servers are running, you will need to Stop and Start them again to use new document root
If you are using MAMP Pro:
- Go to Hosts tab
- Click on folder icon to change document root, select the folder you have created in Dropbox
- If Servers are running, you will need to Stop and Start them again to use new document root
Note for MAMP Pro users: If you are running Apache/MySQL server as user www/mysql you will not be able to change document root. (I am not sure about its reason yet)
Voila, your project files are not stored in dropbox. But, your databases are still not synced.
Step 3
Let’s now move databases to dropbox.
- Move your database files to dropbox.
MySQL files are stored in /Applications/MAMP/db/mysql folder by default. You simply need to move mysql folder to dropbox. You can change name of folder if you want to. For next steps i am assuming that you have moved mysql folder to ~/Dropbox/mysql - Next you need to create a symbolic link (symlink) between new location of database and its old location.
Open ther Terminal and navigate to /Applications/MAMP/db folder
Run following command to create a symlinkln -s ~/Dropbox/mysql mysql
Note: Make sure to use path of new mysql folder you have created in dropbox.
- Done, you will notice that mysql folder is now back in /Applications/MAMP/db folder, but it also have a small arrow in its corner. This arrow represents that this folder is actually a symbolic link.
If you check the details of this folder with Get Info option, you can see the original path of this folder which is in your dropbox
Now your MySQL databses are also synced in dropbox.
You can also check this by running ls -ll in the same folder, this command will list all folders in your terminal window, and you should see something like:
mysql -> /Users/your.name/Dropbox/mysql/
That’s all Folks.
Can you provide a pdf file with these instructions?
Thanks.
Roberto.