Tuesday, 26 March 2013

Synchronize Google Drive and Linux with grive

Waiting for the official client of Google Drive for Linux, there are meanwhile two good unofficial solution to sync your files with the file storage service provided by Google. These are:

InSync: a very nice option, that works with Linux, but also with Widows and Macintosh  InSync for Linux is still in beta, and is free until it will be in beta version. After that it will cost a one-time fee of $9.99 for each account that you want activate.

Grive: is a good open source solution, but has some limitations, as no-automatic syncing of files in background, even though is possible make up for this problem running grive automatically, every 10 minute for example, using cron.

I have chosen grive, because I think is enough for me. Let's see how install grive in any Linux distribution as Ubuntu, Fedora, OpenSuse etc...

Firt of all, run this command from the terminal, to install all the dependencies (the command is for ubuntu but the essential package to install are the same):
sudo apt-get install git cmake build-essential libgcrypt11-dev libjson0-dev libcurl4-openssl-dev libexpat1-dev libboost-filesystem-dev libboost-program-options-dev binutils-dev
Then we download grive with "git clone":
git clone git://
cd ./grive
cmake .

After that, copy the grive executable in the directory that you want sync with Google Drive, if you don't have the directory yet, let's create it:
mkdir ~/GoogleDrive
cp ./grive/grive ~/GoogleDrive

Move in the Google Drive directory and run grive for the first time to authenticate your google drive account:
cd ~/GoogleDrive
grive -a

Click in the huge link, and authenticate your account with your browser, the copy the code in the terminal, and you are done. To synchronize whenever you want run in the terminal:

Then if you want to perform an automatic sync every 10 minute, just use cron! and add this line:
*/10 * * * * $HOME/GoogleDrive/grive
in the crontab:
crontab -e

That's it! Now every 10 minute grive will sync your pc directory with google drive! If you want change the time between two sync... Is too easy you already kwnow how do it...

1 comment:

  1. I had to install the whole of the boost libraries, Qt and yajl. I am not a programmer and this was reasonably challenging for me. Having said this, I got grive working when my previous efforts to get insync working failed, and I had to pay for that!