Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to use gcalcli

📅 2013-Nov-19 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

If you spend a lot of time at the terminal, you might like to access your Google Calendar at the shell too. A great tool to do this is gcalcli. It shows information from all your calendars in Google Calendar, in various formats and using colors.

Install

From Ubuntu archives

To install:

$ sudo apt install gcalcli

Note that this is an old version, it did not work for me.

From Python Package Index

To install:

$ sudo pip install gcalcli

This worked without problems on Ubuntu 14.04, but had problems on Ubuntu 15.04.

Build from source

Before you install gcalcli, first install the Python libraries that it depends on:

$ sudo apt install python-gflags python-googleapi

After this, clone gcalcli from its Github repository:

$ git clone https://github.com/insanum/gcalcli.git

Finally, install gcalcli using its setup.py file:

$ cd gcalcli
$ sudo python setup.py install

Usage

The gcalcli project has a Client ID and Client Secret registered with Google to access its API. You need to authorize it to access your Google account only the first time. To do this, call gcalcli with any of its options, for example:

$ gcalcli agenda

This opens a Google URL in your browser asking whether you want to authorize gcalcli to access your Calendar. Authorize it and come back to the terminal. Let the gcalcli command exit or just kill it. gcalci would have stored the authorization information in ~/.gcalcli_oauth.

From here on, you can call gcalcli with any of its options and it works using the stored authorization information.

To view your events for the next few days:

$ gcalcli agenda

To view your calendar for this week:

$ gcalcli calw

To view your calendar for this week and the following week:

$ gcalcli calw 2

Tried with: Ubuntu 14.04 and Ubuntu 15.04