Using Mendeley and Dropbox to sync your pdf library across computers

Mendeley is a pdf and reference manager software that has a number of cool features: online/offline support, tools for creating public groups (=collections of references), and last but not least, it’s fast and easy to use. Since your references are synchronised via the online service, you can run Mendeley on more than one computer/device. However unless you pay for a fee you will be able to synchronise only up to 1 gig of data through it, which is probably not enough for some people. So here’s a simple method for using a cloud service like Dropbox to sync your entire pdf library without having to pay a cent.

The basic idea: keep all of your pdf files in the cloud using a Dropbox folder; also, keep the Mendeley database and preferences in the cloud, so that they are shared across computers. Finally, point Mendeley to that Dropbox folder and let it do the rest for us (e.g. keeping it organised etc.).

Warning: since with this method the preferences and database are shared across computers, you must make sure you don’t use Mendeley at the same time on both computers as that could lead to some conflict!

This recipe assumes that you have two macs and both Dropbox and Mendeley installed on both of them. We’ll call one of the two machines mac-1, and the other one mac-2.
Also, the method requires that you are using the same username on both macs. I know, this is a big limitation, but since Mendeley indexes pdf files using their full path that’s the only way for things to be wired up correctly (otherwise on one of the two macs the path of the pdf files will be broken).

1. Set up Mendeley and DropBox on mac-1

On Mac-1, create a Mendeley folder in your Dropbox. Within that, create two new folders, pdf and db.
Now launch Mendeley Desktop and in the preferences panel set the pdf-files location to the pdf folder you just created. After clicking on ‘apply’ Mendeley will move your existing library (if you have one) into the new folder. Wait till that’s finished before moving on to step 2.

Mendeley Prefs

2. Add Mendeley database to DropBox on mac-1

Close Mendeley Desktop on mac-1. Now open up the terminal and symlink the ~/Library/Application Support/Mendeley Desktop folder to the db folder just created in Dropbox. This way the DB and preferences can be shared across computers.


[mac]@mac1:~/Library/Application Support>cp -r Mendeley\ Desktop/ ~/Dropbox/Mendeley/db/
[mac]@mac1:~/Library/Application Support>mv Mendeley\ Desktop/ _backup_Mendeley_Desktop/
[mac]@mac1:~/Library/Application Support>ln -s ~/Dropbox/Mendeley/db/Mendeley\ Desktop .

Dropbox will start cloud-syncing the new folder we added. In the meantime, you can try launching Mendeley and checking that everything works at it should.

3. Set things up on mac-2

Put to sleep mac-1 and wake up mac-2. If you’re online, Dropbox on mac-2 will immediately start downloading all the new stuff you previously added to it (via mac-1). In the meantime, quickly open up Mendely and update the preferences as we did in step 1 above. Then closed it down.

Once the Dropbox download is finished, we can set up the symlink to the Mendeley database as we did in step 2 (no need to copy the db folder this time, because we’re using the folder already present in Dropbox/Mendeley/db):


[mac]@mac2:~/Library/Application Support>mv Mendeley\ Desktop/ _backup_Mendeley_Desktop/
[mac]@mac2:~/Library/Application Support>ln -s ~/Dropbox/Mendeley/db/Mendeley\ Desktop .

That’s it. You now should be able to open up Mendeley and have your entire library synchronised across the two computers (effectively, you’re working on a single library since your database is shared too).

Obviously you can still use the web-sync service, which is handy for example if you use also some mobile device. There you’ll still have the 1gig limitation for the pdf files, but at least for me that’s hardly a problem cause I don’t need to have my entire library on the go all the time (I just have a folder called ‘syncedStuff’ in Mendeley Desktop and synchronise only the files attached to that).

If things go wrong..

Well, I’d expect any wise pdf-collectors to make regular backups of their precious databases. In some cases though it’s not just a matter of putting things back as they were; for example once I moved the pdf source files to a different location, launched Mendeley and discovered that although my library was still there all the pdf links were broken.
Since I wanted to keep the new paths for all the pdf files, as a last resort I tried to hack into Mendeley’s own SQLite database and clean things up myself.

Here’s another post that explains how to modify Mendeley’s database manually: Using Mendeley effectively on multiple systems using an external storage drive

This is pretty easy actually. Mendeley stores the full file paths to your files in its database. In particular, the database file can be found in /Application Support/Mendeley Desktop, and it is named like this: youremail@www.mendeley.com.sqlite.

All you have to do is this: close down Mendeley (if it’s running), make a backup copy of the database file for safety purposes, then open it up using a SQLite GUI (e.g. on mac you can use SQLite Browser which is free). You’ll see that the Files table contains all the (wrong) paths to your pdf files; now you can update these paths by launching a simple ‘execute’ command, e.g.:


update Files set 
  localurl = replace(localurl, '/Users/me/Dropbox/Mendeley/old/path/', '/Users/me/Dropbox/Mendeley/new/path/');

Make sure the command did its job by checking the Files table contents; if that’s the case, the next time you launch Mendeley it won’t have no broken links anymore!

 

Share/Bookmark






44 Responses to “Using Mendeley and Dropbox to sync your pdf library across computers”

Thanks a lot. It works perfect! :-)
I use it for syncing Mendeley on Linux and Mac.

Only if you later like to change the document path in Mendeley it is wise to pause Dropbox sync and to close the Mendeley instance on the other machine. Otherwise I experienced that the old configuration might be synced backwards.

Stefan added these pithy words on Aug 13 12 at 6:59 pm

I see – thanks for pointing that out!

mike added these pithy words on Aug 14 12 at 9:03 am

Kind weird to reply to 3yr old post but it’s easy to fix.

For Linux (or to be more specific Ubuntu) you just need an extra step because personal files are in /home rather than /Users

Assuming that you have the same user name for both systems, you can just create a sym link named /Users. What you need is first move to the top directory of the ubuntu drive then create a sym link. Like this:

cd /
ln -s home Users

Aki added these pithy words on Dec 19 15 at 11:13 am

nice work…do you think this would also work when one computer is a mac and the other is a pc?

Andy added these pithy words on Aug 23 12 at 3:18 pm

I’m not sure; the dropbox bit will, but maybe you’ll have problems with step 2, as it relies on a feature specific of unix-like systems (symlinks). However after a quick google search I see that there are symlinks (or similar: http://www.groovypost.com/howto/microsoft/make-dropbox-sync-any-folder-on-your-pc-using-symbolic-links/) on pcs too .. so probably it’s worth a try!

mike added these pithy words on Aug 23 12 at 9:27 pm

Hi,

This works very well – thanks! One issue that I keep having is that the syncing of the subfolders does not appear to work properly. That is, when I put a file into a subfolder at my office mac and close Mendeley afterwards, it’s not referenced in the corresponding subfolder at my laptop at home (after having opened up Mendeley). Any idea what the reason for this could be?

Also, in my Mendeley/db folder in Dropbox, I get conflicted files for the monitor.sqlite – does that have anything to do with the issue I’ve described above?

Cheers,

Tobi

Tobi added these pithy words on Aug 26 12 at 1:07 pm

I’ve never used subfolders so I can’t really help you with that (promise I’ll give it a go soon though!). Regarding the second issue, it *might* indeed be related to the first one as I never had any problem like that..

mike added these pithy words on Sep 04 12 at 2:54 pm

Will this duplicate files? I’ve tried to sync PDFs using Dropbox and Mendeley in the past (not using this method, of course), and got duplicates when I renamed files. I think having Mendeley and Dropbox syncing simultaneously was problematic. Will the method outlined above avoid this issue? Thank you!

Brian added these pithy words on Oct 08 12 at 9:38 pm

no this method won’t cause any duplicate, because as far as Mendeley goes there is only *one* database and pdf folder.

mike added these pithy words on Oct 12 12 at 10:58 am

This is good stuff!

Since I use two macs and several PCs I wonder what would happen if I don’t yse step 2. If I tell each mendely installation to use the dropbox/pdf/ as a watchfolder and add any pdf there to its local database, would that not work? Would I loose some functionality?

bergh added these pithy words on Oct 25 12 at 2:34 pm

Thanks a lot! This document has been very useful for me!

Manuel added these pithy words on Oct 27 12 at 11:36 am

I do not think this will work on PC/Mac. I tried the method and created a symlink using the mklink in windows. but the file location for both windows and mac are different in windows it is C:\Users\loggeduser\Dropbox\mendeley and in mac /Users/loggeduser/Dropbox/mendeley this will create an issue. It has to be either 2 windows with same username or two mac with same username.

Correct me if I am wrong on this? or anybody who is successful in getting this work on a Mac and PC

-Mohan

Mohan added these pithy words on Oct 28 12 at 6:54 am

you’re right it won’t work across different operating systems, due to the different ways folders are managed.

Mikele added these pithy words on Mar 05 13 at 6:13 pm

but who got the solution for this then?

ali added these pithy words on Jul 07 13 at 4:50 pm

No way to get it done:

/Library/Application: No such file or directory error once and again

it seems it is not able to read the space between “Application support”

Mountain Lion on the run

Any ideas?

Thanks

Raul added these pithy words on Nov 08 12 at 12:45 pm

Try using tab for autocompletion. Otherwise look here http://apple.stackexchange.com/questions/14683/how-to-cd-to-a-directory-with-a-name-containing-spaces-in-bash

Mikele added these pithy words on Mar 05 13 at 6:14 pm

Thanks for the instructions. Though I’m having a little trouble. Following everything, I can get the database to sync just fine, but if I add a file on one computer, it does not get linked in the database on the second computer. The DB shows the entry, the PDF is in the PDF folder, but there’s no link in Medeley to open the associated PDF. Any suggestions?

Matt added these pithy words on Nov 12 12 at 1:31 pm

are you using the same usernames on both macs? that’s a precondition for this method to work..

Mikele added these pithy words on Mar 05 13 at 6:16 pm

I am wondering if you could give us a detailed desciption of how to sync Mendeley between two Windows based PCs/Laptops based on your method described here. I am a newbie to Mendely and I would like to have my database and PDFs (with Mendeley’s auto re-name function beeing active) being synchronized via DropBox on my Windows based computers. In particular, how is the symlink step accomplished. Thank you in advance!

Georg Krainer added these pithy words on Nov 20 12 at 6:28 pm

Creating symlinks in Windows is easy: http://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/

However I can’t help you setting this up in more details cause I’m not a windows user….

Mikele added these pithy words on Mar 05 13 at 6:18 pm

Hi. Amazing tutorial ! Thank you
I don´t now much about programmation.
I would like to edit many paths together.
I want to edit first part of the paths of many lines (the paths of many files) that are equal on many paths.

Like this:

old/path/Mendeleylibrary/Paper01.pdf
old/path/Mendeleylibrary/Paper02.pdf
old/path/Mendeleylibrary/Paper03.pdf
old/path/Mendeleylibrary/Paper04.pdf

and change to

new/path/Meneleylibrary/Paper01.pdf
new/path/Meneleylibrary/Paper02.pdf
new/path/Meneleylibrary/Paper03.pdf
new/path/Meneleylibrary/Paper04.pdf

What command Do I use to edit all this paths together ?

Bernardo added these pithy words on Mar 01 13 at 3:35 pm

Hi Bernardo – you can edit those paths by using a SQLite application (see the final section of the article). 
A command like this would update the path of all files in the /old/path/Mendeley folder (make sure you backup your data before trying this out though!):
=========
update Files set
localurl = replace(localurl, ‘/old/path/Mendeley/’, ‘/new/path/Mendeley/’);
=========

Mikele added these pithy words on Mar 05 13 at 6:10 pm

[…] <cite> Using Mendeley and Dropbox to sync your pdf library across computers </cite> […]

Sincronización de artículos con Mendeley y Dropbox | ¡Woof! added these pithy words on Jun 21 13 at 5:20 am

are you sure the symbolic link command is correct? it seems to me that you are creating a link to Dropbox/Mendeley/db/Mendeley Desktop folder from Application Support folder directly. Isn’t it supposed to be
ln -s ~/Dropbox/Mendeley/db/ ./Mendeley Desktop

anons added these pithy words on Oct 31 14 at 2:42 pm

Yes that should be correct, it’s a symlink to the Dropbox folder. The rationale is to trick Mendeley into ‘thinking’ that it is still using the default folder in Application Support – while instead it’s using a folder within Dropbox (which is shared across macs).

Mikele added these pithy words on Nov 25 14 at 9:19 am

Is it possible to use this method in the iOS version of Mendeley?

Miguel Oliveira Jr added these pithy words on Jul 22 15 at 5:45 pm

No I don’t think so.

Mikele added these pithy words on Jul 22 15 at 10:27 pm

Is it possible to use this method in the iOS version of Mendeley??

Miguel Oliveira Jr added these pithy words on Jul 22 15 at 5:46 pm

Thanks a lot! It worked! I’m now syncing my Mendeleys on my two laptops, via Box. And it was an interesting experience!

Jan Willem Lindemans added these pithy words on Aug 17 15 at 6:47 pm

Thanks a lot. Very useful stuff.
Is it possible to add a third our fourth computer??

Joao added these pithy words on Sep 22 15 at 7:56 am

in principle yes – it’s not something I’ve tried myself though. Also, you keep in mind that you won’t be able to use Mendeley on different machines at the same time!

Mikele added these pithy words on Sep 22 15 at 9:31 am

Thanks for the tutorial. I keep getting an error that reads “is a directory”. I’m not very familiar with bash scripting. How do I get around this? Thanks for the help!

Ian added these pithy words on Feb 07 16 at 4:55 pm

Ian- I suspect you have found your answer by now- it is important to have the exact syntax to avoid this. See: http://superuser.com/questions/354193/cannot-cd-into-application-support-on-mac-os-x-snow-leopard
I managed to get around by using cd to work down to the /Application Support directory. e.g.
cd ~/Library
then
cd /Application Support
then
cp -r Mendeley Desktop/ ~/Dropbox/Mendeley/db/

Charles Estus Jr added these pithy words on Apr 14 16 at 11:01 pm

I am using this method on two different macs however the computers have different path names. I’ve linked each to drop box, and the issue that I’m having is that my second computer is re-downloading all the files and saving them into the drop box file. I don’t mind this so much, but once its all downloaded will everything still work? I guess once I download a couple of new papers on one computer it will redownload on the other? Thanks in advance :)

Calum Fox added these pithy words on Apr 08 16 at 1:41 am

Hi-
This seems a bit out of left field- but I tried using the terminal commands as you had listed above and ran into trouble first when /Application Support wasn’t recognized- I used the backslash () for the space- but then received the message ‘Application Support’ is a directory and Terminal went back to $. (I have disabled SIP).

Any thoughts as to how to tweek these commands for El Capitan 10.11.4?

Thanks!
-C

Charles Estus Jr added these pithy words on Apr 12 16 at 2:40 am

Not sure what the problem is, but maybe this thread can help you: http://superuser.com/questions/354193/cannot-cd-into-application-support-on-mac-os-x-snow-leopard

I’m running El Capitan and ‘cd ~/Library/Application Support/’ runs as expected…

Mikele added these pithy words on Apr 12 16 at 9:06 am

Mikele, It seems I was able to cd down to the App Support folder. I had to go in steps: cd ~/Library then cd Application Support. From there I was able to copy, mv (rename), and link. The porlem persisted when I launched Mendeley and received an error pointing that the path was incorrect.

Now trying to find the SQLite command to view/edit content of db.

Also i cleared my .ds store files using Onyx.
Thanks!

Charles Estus Jr added these pithy words on Apr 13 16 at 2:44 am

Very good news

Mikele added these pithy words on Apr 18 16 at 9:31 am

Success~! Thanks.

Charles Estus Jr added these pithy words on Apr 14 16 at 11:07 pm

Hey,

I ran out of mendeley.com space and wanted to keep my desktop versions synced across platforms. I have already been saving all of my pdfs to Google Drive and I have a file folder structure, annotations, highlighting etc. I want to keep. Will doing the steps above completely screw all of that up? Thanks!

Vincent Ng added these pithy words on Aug 30 16 at 9:35 pm

Bear in mind that this solution has nothing to do with mendeley.com space. In all cases, I would not recommend trying this out without backing up your Mendeley library first.

Mikele added these pithy words on Apr 28 17 at 1:21 pm

Thanks for posting, but after I am done with all the steps for mac1, the app mendeley wont open. I get a message: “The data directory is set to ‘Users/username/Library/Application Support/Mendeley Desktop’, but it could not be created.” Any idea what the problem is? I have Yosemite.

Nena Kat added these pithy words on Apr 06 17 at 4:53 pm

Did you manage to complete step 1, at least? The error message looks funny. Does it actually say ‘username’ or did you change that?

Mikele added these pithy words on Apr 28 17 at 1:19 pm

Some of you have inquired as to how this can be done with two Windows computers. This was years ago, so your problems are likely solved or forgotten, but I solved it, so I’ll pay it forward. I didn’t know symlinks were a thing, so this solution would never have occurred to me.

First thing is to make sure your computers have the same account name. Unfortunately, it has to be the name FIRST attached to the account so that the folder in C:Users… is the same. I have discovered that capitalization is not a problem (my folder name on my laptop is, for whatever reason, all lower case, but my desktop is capitalized).

If they aren’t already, put your pdfs in a folder on your cloud. I noticed the original author on this post tells Mendeley to copy .pdfs to a folder. I already keep all mine in one place and tell Mendeley to watch that folder. Either way, do that on the cloud.

Next, open Mendeley on whichever of your computers is better organized (or organize one of them), then hit ctrl + shift + D. A little debug window should open. Click ‘Open Data Directory.’ This should open the database folder referred to in the original post. With this open, CLOSE MENDELEY. Go up one folder level to Mendeley Ltd. Cut and paste the ‘Mendeley Desktop’ folder to your cloud. You can rename if it if you want. Make sure to cut it (rather than copy it), because creating a directory hard link creates a new folder.

Open command prompt as an admin. It should default to C:WINDOWSsystem32. If not, navigate there. Now you’ll create the symlink between the folder in you cloud, which contains your database info for Mendeley, and the original folder location. This way, when Mendeley accesses it and manipulates it, it will actually be working on the cloud.

The command follows the format:
mklink /J Link Target

where the Link is the ‘fake’ folder that will be set in the Mendeley directory, and Target is the real folder in your cloud directory. Also, note it is a forward slash in /J. Your final command prompt line should read:

mklink /J “C:UsersnameAppDataLocalMendeley LtdMendeley Desktop” “C:UsersnameOneDriveDocumentsMendeley Database”

This is, of course, dependent on which cloud service you are using and your actual file path. And whatever you name the database folder in your cloud directory (mine is Mendeley Database”). If there are any spaces (as there are in mine), it requires spaces. Remember that you removed the original ‘Mendeley Desktop’ folder in the Mendeley directory, and so this command creates a new one. If you did not remove it you will see an error.

Now go back to your ~/Mendeley Ltd folder. You should see a new ‘Mendeley Desktop’ folder, and it should appear to contain all the things that were moved to your cloud folder. You can reopen Mendeley to confirm that this was successful.

Next, do the same thing to your other computer, except instead of moving your Mendeley Desktop folder, just delete it (this is why I said start with your more organized computer). The command script should be identical, and you should now have the same database folder linked to the Mendeley directory on each computer.

Dylan Simpson added these pithy words on Apr 25 17 at 11:31 pm