Install the Google command line tool

Jun 22, '10 07:30:00AM

Contributed by: Anonymous

Google has released a command line tool to access many of their services. This is obviously handy for batch processing with scripts. The tool is largely written in Python and is open source, so it's highly portable and runs on the Mac.

The following services are currently supported:

The easiest way to install these tools is using MacPorts. If you don't have MacPorts installed, the current version's installer is available on disk image from the link above. You will need to have the Apple Developer Tools installed to compile programs. [crarko adds: googlecl is also available from Fink, if you use that package manager instead.]

If you already have MacPorts, run the following commands in Terminal:

sudo port selfupdate
sudo port install googlecl
This will update MacPorts to the most recent release, and then fetch and build the GoogleCL utilities.

The GoogleCL project page has many example of use, including example scripts. You can also download source code from there.

A simple example of use is google contacts list name,email > contacts.csv, which will fetch your contacts list and save it to contacts.csv in the current directory.

The first time you run the google command to access information from your Google accounts, you will be asked to log into those accounts and authorize the utility for access.

[crarko adds: I tested this, and it works as described. It may take a while to build and install the packages.]

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20100622050822706