Mounting Google Drive on Arch Linux

Mounting Google Drive on Arch Linux

April 14, 2023(August 23, 2023)
google-drive, opam, arch-linux

In this note, I will share my personal experience on how to mount Google Drive on Arch Linux using google-drive-ocamlfuse.

Install opam #

First, I need to install opam using the following command:

sudo pacman -S opam

Initialize opam #

Next, I initialize opam with this command:

opam init

Install google-drive-ocamlfuse #

After initializing opam, I install google-drive-ocamlfuse with the following commands:

eval $(opam env)

opam install google-drive-ocamlfuse

Append environment variable #

I add the following lines to ~/.zshenv file to set up the environment variables:

# opam
export OPAMROOT="${XDG_DATA_HOME}/opam"
export PATH="${PATH}:${OPAMROOT}/default/bin:"

Authorization #

I run google-drive-ocamlfuse without any parameters to start the authorization process:

google-drive-ocamlfuse

This launches a web browser to obtain authorization to access my Google Drive.

Mount Google Drive #

I create the mount point (if it doesn’t exist) and mount my Google Drive using the following commands:

mkdir ~/GoogleDrive
google-drive-ocamlfuse ~/GoogleDrive

Auto-mounting #

To automatically mount Google Drive when I start a new shell session, I add the following lines to ~/.zshenv file:

local GOOGLE_DRIVE="${HOME}/GoogleDrive"

if [ -x "$(command -v google-drive-ocamlfuse)" ] && ! mountpoint -q "$GOOGLE_DRIVE"; then
    google-drive-ocamlfuse "$Google_Drive"
fi

That’s it! Now I can mount Google Drive on Arch Linux using google-drive-ocamlfuse. I hope this note helps you set up Google Drive on your Arch Linux system.