The latest released version of the ruby-libvirt bindings can be downloaded from:

Distribution Packages

If your distribution packages the ruby-libvirt bindings, this is the easiest way to obtain the code and binaries. The bindings are packaged for at least:


The ruby-libvirt package is also available via gem. To install the ruby-libvirt gem, make sure you have rubygems installed and then run:

$ gem install ruby-libvirt

GIT source repository

The ruby-libvirt source code that is in development is maintained in a git repository available on GitLab:

git clone


In order to compile ruby-libvirt, you will need to have the development libraries for both ruby and libvirt installed. These are typically called something like ruby-devel and libvirt-devel. Once those are installed, the library can be compiled using rake:

$ tar -zxvf ruby-libvirt-xxx.tar.gz

$ cd ruby-libvirt-xxx

$ rake build

If the libvirt development libraries are header files are in a non-system location, the ruby-libvirt bindings can be compiled against them by using:

$ rake build -- --with-libvirt-include=/home/clalance/upstream/libvirt/include --with-libvirt-lib=/home/clalance/upstream/libvirt/src/.libs

(due to the way that rake parses command-line arguments, the -- immediately after the build argument is required)