google-drive-ocamlfuse is a FUSE-based file system written in Ocaml, which makes it possible to mount Google Drive on Linux Systems.
Features
- Gives full read/write access to ordinary files/folders.
- Provides read-only access to Google Docs, sheets and slides.
- Access to Trash (.trash) Directory.
- Duplicate file handling.
- Support for multiple accounts.
Installation of google-drive-ocamlfuse on Linux
1. Google-drive-ocamlfuse tool can be easily installed on Ubuntu 15.04, 14.10, 14.04, etc. and it’s derivatives by adding a PPA repository.
$ sudo add-apt-repository ppa:alessandro-strada/ppa $ sudo apt-get update $ sudo apt-get install google-drive-ocamlfuse
On Archlinux, you can easily install google-drive-ocamlfuse from the AUR package.
$ yaourt -S google-drive-ocamlfuse
For most of other Linux distributions, you have to compile it from source using following commands.
2. If you are running a different Linux distribution, you must compile it from source, for this you must have OPAM (an OCaml package manager) installed on the system.
$ sudo apt-get install ocaml camlp4-extra
Note: If the above process reports that OPAM could not be installed, as it is not provided by any package for your distribution, you have to compile and install it using following commands.
$ git clone https://github.com/OCamlPro/opam.git $ cd opam $ ./configure $ make $ sudo make install
3. Next install the C tools and libraries: m4, curl, fuse, and sqlite3. These dependencies packages are must installed on the system, in order to compile the executable. If you are using a .deb based distribution, you can easily install these libraries using following command.
$ sudo apt-get install m4 libcurl4-gnutls-dev libfuse-dev libsqlite3-dev
4. Once all above needed dependencies are installed, start and update the OPAM.
$ opam init $ opam update
5. Now it’s time to install google-drive-ocamlfuse.
$ opam install google-drive-ocamlfuse
Usage of Google-drive-ocamlfuse
6. Firstly, you need to authorize google-drive-ocamlfuse with your Google account by running following command.
$ google-drive-ocamlfuse
As soon as you fire the above command, a page will open in default web browser and it will ask you to authorize and allow google-drive-ocamlfuse to access your Google Drive with your Google account. Enter your Email and Password.
7. Once you logged into your Google account, you need to accept the term and services.
8. You are asked to enter your Password once again.
9. Allow and give permission to application gdfuse OAuth2 to access your Google account.
I guess this article is pretty old now, but I tried it today and, after installing lots of additional packages on my Debian machine, I got it working. As noted, it’s pretty slow. Also, $USERNAME didn’t seem to exist but maybe this is just shorthand for inserting the real username of the google drive being mounted?
There is something strange about the way your code blocks are displaying; ~ is changed to – in my browser (Firefox)
Does anyone know how this method compares to eg grive/grive2? The latter methods, I’ve had bad experiences with, so I’ll try this new method now, thanks a lot for the article…
It is too slow. See my comment on March 28, 2016.
Is it possible to edit this to use lynx instead of “xdg-open”, “firefox” or “google-chrome”. Been following this to install on one of my headless servers which has no gui and therefore no graphical browser.
@Rob,
Not possible, better install GUI on Linux server to use Firefox or Chrome browser..
Only a Microsoft Windows Server administrator would think a GUI on a GNU/Linux server is a good idea. There are terminal file managers available for GNU/Linux; try integrating one or more of them with google-drive.
Was thinking the same thing, this might help you found this on the official github site.
Haven’t tried it myself, but it seems it is possible with a few work arounds or different steps.
https://github.com/astrada/google-drive-ocamlfuse/wiki/Headless-Usage-&-Authorization
When I try to give ownership to avi, it says “user is not found” .Any idea?
@Lim,
That’s an example user “Avi” used in the article, you should replace that user name with yours..
This caused Linux Mint to stop booting!
Thanks a lot folks, very useful, even if I have no knowledge about Linux (sorry my English, I do not speak English).
Hi,
I have had to change:
gdfuse#default /mnt/gdrive fuse uid=1000,gid=1000 0 0
to:
gdfuse#default /mnt/google_drive fuse uid=1000,gid=1000,user 0 0
@Jacques,
Thanks for sharing the tip, but could you tell us why it needed and how you came to know? it will help us to correct the article with correct explanation. So, that end users will know more better about the command.
With the user options the user can mount and unmount the drive without the usage of sudo
Thank you very much for this tutorial. It is really very useful.
The question is what to do if you only have the command line and no GUI (so no browser too ;-).
Thank you.
google-drive-ocamlfuse on Lubuntu 14.04 is too slow. I tried to use vi to edit a text file in google-drive, when I pasted about 2KB text from clipboard, it took around 60 seconds. The same thing works smoothly on pCloud.com, it seems that pCloud do caching well.
Thanks for the guidelines! I successfully installed google-drive-ocamlfuse on Lubuntu 14.04.
google-drive-ocamlfuse doesn’t allow to change file timestamps. Commands “cp -p” or “rsync -a” always create files with present modification time. Therefore, rsync is useless.
I can’t get step 12 to work. It says label needs an argument.
i can not install it. have an error. can you help?
[root@server opam]# opam install google-drive-ocamlfuse
[WARNING] Running as root is not recommended
The following actions will be performed:
∗ install sqlite3 4.0.3 [required by google-drive-ocamlfuse]
∗ install google-drive-ocamlfuse 0.5.22
===== ∗ 2 =====
Do you want to continue ? [Y/n] y
=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[google-drive-ocamlfuse] Archive in cache
[sqlite3] Archive in cache
=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ERROR] The compilation of sqlite3 failed at “ocaml setup.ml -build”.
Processing 1/2: [sqlite3: ocamlfind remove]
#=== ERROR while installing sqlite3.4.0.3 =====================================#
# opam-version 1.2.2
# os linux
# command ocaml setup.ml -build
# path /root/.opam/system/build/sqlite3.4.0.3
# compiler system (4.02.3)
# exit-code 1
# env-file /root/.opam/system/build/sqlite3.4.0.3/sqlite3-6418-1872ec.env
# stdout-file /root/.opam/system/build/sqlite3.4.0.3/sqlite3-6418-1872ec.out
# stderr-file /root/.opam/system/build/sqlite3.4.0.3/sqlite3-6418-1872ec.err
### stdout ###
# /usr/bin/ocamlopt.opt unix.cmxa -I /usr/lib64/ocaml/ocamlbuild /usr/lib64/ocaml/ocamlbuild/ocamlbuildlib.cmxa myocamlbuild.ml /usr/lib64/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
# Failure: pkg-config failed for cflags.
### stderr ###
# Package sqlite3 was not found in the pkg-config search path.
# Perhaps you should add the directory containing `sqlite3.pc’
# to the PKG_CONFIG_PATH environment variable
# No package ‘sqlite3′ found
# E: Failure(“Command ”/usr/bin/ocamlbuild’ lib/libsqlite3_stubs.a lib/dllsqlite3_stubs.so lib/sqlite3.cma lib/sqlite3.cmxa lib/sqlite3.a lib/sqlite3.cmxs -tag debug’ terminated with error code 2″)
=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions were aborted
∗ install google-drive-ocamlfuse 0.5.22
The following actions failed
∗ install sqlite3 4.0.3
No changes have been performed
=-=- sqlite3.4.0.3 troobleshooting =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=> This package relies on external (system) dependencies that may be missing. `opam depext sqlite3.4.0.3′ may help you find the correct installation for your system.
Do you yearn for a Linux client of Google Drive? Here is one for you. I have written this out of same frustration as you had. Please visit:
http://www.nulltrace.org/p/gosync.html
for more details.
@Himanshu,
First of all I would like to thank you for creating Linux Client for Google Drive and wishes you best of luck for this project. I definitely share this tool with our Tecmint article..
@Ravi Thanks! A new version of GoSync Google Drive client for linux is available to install from pip or github. Please visit https://github.com/hschauhan/gosync/releases/tag/v0.4 for more details.
v0.4 is more promising. Please use that can provide feedback to make it better!
Anothher way for automounting (in KDE)
I just added the commando ‘google-drive-ocamlfuse ~/google-drive’ to Menu -> System Settings -> Startup & Shutdown -> Autostart
works great
@v7peer,
Thanks for the tip, hope it will help KDE users..
Hi,
do you try this on OSX ?
If yes how do you proceed please ?
Thanks for all
@Bacoco,
We’ve tried on Ubuntu Linux flavors, not on OSX…
I got many error after $ opam init
like this
[WARNING] Errors while parsing flowtype.0.9.1 OPAM file, skipping.
[ERROR] Your version of OPAM (1.1.1) is not recent enough to read ~/.opam/repo/default/packages/flowtype/flowtype.0.9.2/opam. Upgrade OPAM to a more recent version (at least 1.2) to read this file correctly.
How to fix it ?
Whenever I run the google-drive-ocamlfuse It brings up a webpage that has an error on it..
400. That’s an error.
Error: invalid_request
Invalid response_type: code\\
Learn more
Request Details
That’s all we know.
were you able to authenticated it?
Hi!
If I use this FUSE method, I’ll be use local storage?
thanks.
Welcome and Good to know.
Keep connected!
Thanks for sharing the guidelines. I can’t see the Files / Directorties those are shared with me in the mount.
Please let me know how to view them as well.
I don’t know but the time you posted this comment it might be syncing.
Hope it is fixed now.