Skip to the content.

How To Get Photos on GooglePhotos To Local

gphotos-sync Installation

gphotos-sync is a command line python application that uses the Google Photos API. Installation is not very complex since there is a pip package. First make sure you have pip installed:

apt install python3-pip

# install gphotos-sync wih pip:
python3 -m pip install gphotos-sync

# export ~/.local/bin in PATH if you haven't already (that's where the executables for packages installed using pip3 are stored)
echo "export PATH=\"\$PATH:\$HOME/.local/bin\"" >> ~/.bashrc

# run .bashrc for updated PATH
source ~/.bashrc

Google API Authentication Setup

The gphotos-sync manual has an up to date version of these instructions. At the time of writing this article they were working, but with Google you can never be sure what happens and when stuff is deprecated.

I saved it in my ~/Downloads folder and then moved it to the correct folder for gphotos-sync, creating it if it does not exist:

mkdir -p ~/.config/gphotos-sync/
cp ~/Downloads/client_secret*.json ~/.config/gphotos-sync/client_secret.json

gphotos-sync Usage

# create a folder where your pictures are going to be synced to:
mkdir -p ~/gphotos-sync/

# also authorize the client, it will ask you the first time you sync:
gphotos-sync ~/gphotos-sync/ --progress
# 04-12 12:55:28 WARNING  gphotos-sync 3.1.2 2023-04-12 12:55:28.485621
# Please visit this URL to authorize this application: https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=636621971213-53d9gq8ohb5avnoqnqa1g8q89br2nfhi.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fphotoslibrary.readonly+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fphotoslibrary.sharing&state=6f96B8GNg5jQEpLe7q0j4vOBm9g4qu&access_type=offline

Your pictures will be in ~/gphotos-sync/photos.

The next time you sync, only new photos will be downloaded. The tool is not able to detect changed photos, due to API limitations, so changes will not be detected. It will also not delete local pictures.

Ref: https://unix.stackexchange.com/questions/711221/how-can-i-download-and-sync-my-google-photos-to-linux
Ref: https://raymii.org/s/tutorials/Local_incremental_Google_Photos_backup_on_Ubuntu.html
Ref: https://docs.google.com/document/d/1ck1679H8ifmZ_4eVbDeD_-jezIcZ-j6MlaNaeQiz7y0/edit

Usage Scenarios

For detailed usage informations, type gphotos-sync --help.

Some of the gphotos-sync features/options are as follows:

Dowload Latest Photos on Your Account

gphotos-sync ~/gphotos-sync/$accountname/ --progress

Dowload Photos on Your Account With Controlling Any Change

gphotos-sync ~/gphotos-sync/$accountname/ --progress --rescan --retry-download

Dowload Photos on Your Account Without Dates of Albums

gphotos-sync ~/gphotos-sync/$accountname/ --progress --omit-album-date

Dowload Photos on Your Account Without Albums

gphotos-sync ~/gphotos-sync/$accountname/ --progress --skip-albums

NOTE: If you face any problem like OSError: [Errno 98] Address already in use, rearrange the command as follows:

gphotos-sync ~/gphotos-sync/$accountname/ --progress --rescan --retry-download --skip-albums --port 8081

Ref: https://www.linuxuprising.com/2019/06/how-to-backup-google-photos-to-your.html