How to download GOG games from the command line on Linux

If you are a gamer and a Linux user, you probably were delighted when GOG announced a few months ago that it will start proposing games for your favorite OS. If you have never heard of GOG before, I encourage you to check out their catalog of “good old games”, reasonably priced, DRM-free, and packed with goodies. However, if the Windows client for GOG existed for quite some time now, an official Linux version is nowhere to be seen. So if waiting for the official version is uncomfortable for you, an unofficial open source program named LGOGDownloader gives you access to your library from the command line.

Install LGOGDownloader on Linux

Install LGOGDownloader on Ubuntu or Debian

For Debian-based users, the official page recommends that you download the sources and do:

$ sudo apt-get install build-essential libcurl4-openssl-dev liboauth-dev libjsoncpp-dev libhtmlcxx-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev libboost-program-options-dev libboost-date-time-dev libtinyxml-dev librhash-dev help2man
$ tar -xvzf lgogdownloader-2.17.tar.gz
$ cd lgogdownloader-2.17
$ make release
$ sudo make install

Install LGOGDownloader on Fedora

The credit for this build instruction goes to AM (in the comment below).

First, install prerequisite packages with yum.

$ sudo yum install tinyxml-devel jsoncpp-devel liboauth-devel libcurl-devel boost-devel help2man

Download source code of other required packages and lgogdownloader.

$ wget https://sites.google.com/site/gogdownloader/lgogdownloader-2.17.tar.gz
$ wget http://downloads.sourceforge.net/project/rhash/rhash/1.3.3/rhash-1.3.3-src.tar.gz
$ wget http://downloads.sourceforge.net/project/htmlcxx/htmlcxx/0.84/htmlcxx-0.84.tar.gz

Build and install rhash.

$ tar xfvz rhash-1.3.3-src.tar.gz; pushd rhash-1.3.3; make; make lib-shared lib-static; sudo make install-lib-shared install-lib-static; popd

To add /usr/local/lib to your LD_PATH, append "/usr/local/lib" line to /etc/ld.so.conf, and run the following command.

$ sudo ldconfig

Next, build and install htmlcxx.

$ tar xfvz htmlcxx-0.84.tar.gz; pushd htmlcxx-0.84; ./configure; vi html/tree.h; make; sudo make install; popd

htmlcxx source needs a fix with Fedora. After running the above command, when vi text editor opens up html/tree.h, add "#include <cstddef>" at line 53.

Now all dependencies are taken care of. Finally, let's compile and install lgogdownloader.

$ tar xfvz lgogdownloader-2.17.tar.gz; pushd lgogdownloader-2.17; vi Makefile; make; sudo make install; popd

lgogdownloader's Makefile needs slight editing as well. When vi editor opens up Makefile in the above command, change "-I/usr/include/rhash" to "-I/path/to/rhash-1.3.3/librhash" at line 16. Once you finish editing Makefile, the rest of the step will install lgogdownloader.

Install LGOGDownloader on Arch Linux

If you are an Arch Linux user, an AUR package is waiting for you.

Usage of LGOGDownloader

Once the program is installed, you will need to identify yourself with the command:

$ lgogdownloader --login

Notice that the configuration file if you need it is at ~/.config/lgogdownloader/config.cfg

Once authenticated, you can list all the games in your library with:

$ lgogdownloader --list

Then download one with:

$ lgogdownloader --download --game [game name]

You will notice that lgogdownloader allows you to resume previously interrupted downloads, which is nice because typical game downloads are not small.

Like every respectable command line utility, you can add various options:

  • --platform [number] to select your OS where 1 is for windows and 4 for Linux.
  • --directory [destination] to download the installer in a particular directory.
  • --language [number] for a particular language pack (check the manual pages for the number corresponding to your language).
  • --limit-rate [speed] to limit the downloading rate at a particular speed.

As a side bonus, lgogdownloader also comes with the possibility to check for updates on the GOG website:

$ lgogdownloader --update-check

The result will list the number of forum and private messages you have received, as well as the number of updated games.

To conclude, lgogdownloader is pretty standard when it comes to command line utilities. I would even say that it is an epitome of clarity and coherence. It is true that we are far in term of features from the relatively recent Steam Linux client, but on the other hand, the official GOG windows client does not do much more than this unofficial Linux version. In other words lgogdownloader is a perfect replacement. I cannot wait to see more Linux compatible games on GOG, especially after their recent announcements to offer DRM free movies, with a thematic around video games. Hopefully we will see an update in the client for when movie catalog matches the game library.

What do you think of GOG? Would you use the unofficial Linux Client? Let us know in the comments.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.

Adrien Brochard

I am a Linux aficionado from France. After trying multiple distributions, I finally settled for Archlinux. But I am always trying to improve my system by stacking up tips and tricks.

Latest posts by Adrien Brochard (see all)

10 thoughts on “How to download GOG games from the command line on Linux

  1. If using Fedora, you have to compile several dependencies. It takes a bit of time, but it works.

    One issue I faced was when recompiling htmlcxx when I got the error:
    In file included from ParserDom.h:5:0,
    from ParserDom.cc:1:
    tree.h:118:21: error: 'ptrdiff_t' does not name a type
    typedef ptrdiff_t difference_type;

    The fix was to add "#include " at line 53 of the file tree.h

      • (Feel free to reformat the instructions below to make it look pretty.)

        Here are the steps for Fedora:
        $ sudo yum install tinyxml-devel jsoncpp-devel liboauth-devel libcurl-devel
        $ wget 'https://sites.google.com/site/gogdownloader/lgogdownloader-2.17.tar.gz?attredirects=0'
        $ wget 'http://downloads.sourceforge.net/project/rhash/rhash/1.3.3/rhash-1.3.3-src.tar.gz'
        $ wget 'http://downloads.sourceforge.net/project/htmlcxx/htmlcxx/0.84/htmlcxx-0.84.tar.gz'
        $ tar xfvz rhash-1.3.3-src.tar.gz; pushd rhash-1.3.3; make; make lib-shared lib-static; sudo make install install-shared; popd

        It might be necessary to add /usr/local/lib to your ld_path. It's done by creating a "local-x86_64.conf" file in /etc/ld.so.conf.d/ which contains the line "/usr/local/lib" and as root, call "ldconfig"
        Also, htmlcxx needs a fix with Fedora: in the file html/tree.h at line 53, add "#include {cstddef}" (replace the curly brackets with the angular ones as xmodulo.com think it's a tag)
        $ tar xfvz htmlcxx-0.84.tar.gz; pushd htmlcxx-0.84; ./configure; nano html/tree.h; make; sudo make install; popd

        Now all dependencies are taken care of, let's compile lgogdownloader!
        $ tar xfvz lgogdownloader-2.17.tar.gz; pushd lgogdownloader-2.17; make; sudo make install; popd

        If all works well, you should end up with an executable at "lgogdownloader-2.17/bin/Release/lgogdownloader"

    • by reviewing the source code, like any open-source project.

      how do you know your copy of linux doesn't have malware?

  2. Really might want to clean up the installation. No reason this should go into /usr/bin and /usr/man, since it isn't distribution software. /opt or /usr/local is the proper place for it. I tried editing DESTDIR in the Makefile and it dropped it in /usr/local/usr/bin, which is also incorrect. Manually copied the files to /usr/local/[bin,man].

Leave a comment

Your email address will not be published. Required fields are marked *