Okay! I’ve tried the database sync method described by @hellojd above. It works perfectly!!!
I did it a little bit differently on my setup, though. I began with an existing site folder that I was already sharing between two computers on a cloud drive (iCloud for now, although see my cautions about iCloud above). I created it in the following way:
- Create a site in Local on Computer A, with the site path on the shared drive.
- Hide the site folder that was just created by moving it inside another folder (or just delete it – see below).
- Create a site in Local on Computer B, with the site path in exactly the same location as the site you created on Computer A.
- Delete the hidden folder. You no longer need it because Local on both computers will use the same site folder on the shared drive (the one you created from Local on Computer B).
- If you’ve already got a working site from computer A on the shared drive and you want to be able to access it from Computer B, then instead of deleting the site folder from Computer A, delete the one you’ve just created from Computer B and unhide the one from Computer A.
- If the existing site from computer A is not on the shared drive and you want to have a single shared site folder, then export the site on computer A to a zip file (right click the site in Local and choose "Export) and then reimport it with a site path on the shared drive (choose “Advanced Options” when you import the site).
- If you’re doing all this on iCloud be careful that the cloud is updated with all the file operations before you continue or you may find that your local files are being overwritten by older files not yet deleted from the cloud. iCloud can be slow about file operations (see my caution above). If you’re not sure, go to your iCloud Drive at iCloud.com and do the file operations there.
Now, you could just stop here and sync the databases manually as I described in the previous post. But if you want to go farther and sync the databases automatically, as described by @hellojd above, it’s a simple two-step process.
1. On Computer A, find the mysql folder and drag it to the site folder on the shared drive.
- It’s located in
/Users/Username/Library/Application Support/Local/run/G0xUGB4jj where “G0xUGB4jj” is the unique, randomly generated name of the folder containing the database for your site. The name of your folder will, of course, be different.
- You can find the name and location of your database folder by clicking the Database tab in Local and looking under “Socket”.
- If the Library folder doesn’t appear in your User folder, right click inside the User folder and choose “Show View Options” and select “Show Library Folder.”
- Open the folder (“G0xUGB4jj”) that contains your database. Inside this folder is a folder named “mysql.” This is the folder you want to sync.
- Move the mysql folder to the site folder on your shared drive. Don’t worry about keeping a copy of it in its original location. You don’t want it there anyway, because you’re going to replace it with a symlink to its location on the shared drive. If it doesn’t disappear when you drag it to the shared drive, then delete it (just make sure it’s present on the shared drive first).
2. Create the symlink.
- A symlink is a UNIX feature that is similar to a MacOS alias. Unlike an alias, it can’t be made from within the Finder. You have to use Terminal. But for this purpose an alias won’t work (at least it didn’t for me).
- Open the Terminal app
- Drag the mysql folder from the shared drive into Terminal to copy its location
- Drag the database folder (e.g. “G0xUGB4jj”) into Terminal to copy its location
- You should now see something like this in Terminal:
ln -s path/to/shared/folder/mysql Users/Username/Library/Application\ Support/Local/run/G0xUGB4jj (or whatever your folder is called).
- When you press Return, UNIX will create a symlink inside the G0xUGB4jj folder. Open up the folder and see. It looks just like an alias, with a little arrow in the lower left corner, but it’s really a UNIX symlink.
You should now be able to run Local normally. Start the site and it should work just like a normal installation.
On Computer B, the process is the same, except that in step 1 you’re just going to delete the mysql folder from the “G0xUGB4jj” folder rather than copy it to the shared drive. You’ve already got a copy of mysql on the shared drive from Computer A. Local will use that one for both computers. You’ve still got to create the symlink, though, so step 2 on Computer B is just the same.
If everything is as it should be you should now be sharing the database on the two computers. It actually takes less time to do than it does to describe it.
Try running the site from each computer, one at a time, to check your work. Remember not to run the site on both computers at the same time or you’re likely to run into database conflicts. You don’t have to quit Local, just stop the site on Computer A before you start it on Computer B.
Finally, if these are not both new sites (i.e., if you’re creating a copy of an existing site on a different computer), make sure that it is indeed the database from Computer A that you want to share with both computers before deleting the mysql folder from Computer B.