November 13, 2014 in Wordpress

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:

  1. Open MAMP
  2. Click on Preferences
    mamp-screen1
  3. Go to Web Server tab
  4. Click on folder icon to change document root, select the folder you have created in Dropbox
    mamp-screen2
  5. Click Ok, to close preferences
  6. If Servers are running, you will need to Stop and Start them again to use new document root

If you are using MAMP Pro:

  1. Go to Hosts tab
  2. Click on folder icon to change document root, select the folder you have created in Dropbox
  3. If Servers are running, you will need to Stop and Start them again to use new document root
    mamp-screen3

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.

  1. 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
  2. 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 symlink

    ln -s ~/Dropbox/mysql mysql

    Note: Make sure to use path of new mysql folder you have created in dropbox.

  3. 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.

About the author

Alok Jain

As a Frontend Developer and Founder, I blend technical skills with entrepreneurial drive. Skilled in crafting intuitive user interfaces, I bridge design and development for seamless digital experiences. Beyond work, I'm passionate about Philately, sharing my collection, and connecting with fellow enthusiasts in both tech and stamp collecting communities.

One thought on “How to backup your projects in MAMP using Dropbox

  1. roberto says:

    Can you provide a pdf file with these instructions?
    Thanks.
    Roberto.

Leave a Reply

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