A Ruby binding for DBus
Ruby Shell
#52 Compare This branch is 312 commits ahead of sdague:master.
Latest commit ccf2c03 May 12, 2016 @mvidner Releasing version 0.11.1.
[ci skip]
Failed to load latest commit information.
doc rake doc:examples will extract the inlined examples. Sep 7, 2014
lib Fix default path finding on FreeBSD Jan 23, 2016
spec Avoid be_true be_false for RSpec 3 compatibility: leftover May 21, 2015
.coveralls.yml use coveralls for on-line code coverage reporting at Travis CI Feb 5, 2014
.gitignore use packaging_rake_tasks.gem Jan 2, 2014
.rspec Renamed test/ to spec/ Sep 5, 2014
.travis.yml run tests in verbose mode in OBS and Travis Jan 10, 2014
.yardopts Inlined the examples in the documentation. Sep 7, 2014
COPYING Switch license to LGPL. Apr 25, 2007
Gemfile.ci try fixing the Rubinius build Feb 5, 2014
NEWS Releasing version 0.11.1. May 12, 2016
README.md README: more status badges, moved near the top Feb 1, 2014
Rakefile Fixed rake osc:build. May 12, 2016


Ruby D-Bus

D-Bus is an interprocess communication mechanism for Linux. Ruby D-Bus is a pure Ruby library for writing clients and services for D-Bus.

Gem Version Build Status Dependency Status Code Climate Coverage Status


Check whether the system is on battery power via UPower

require "dbus"
sysbus = DBus.system_bus
upower_service   = sysbus["org.freedesktop.UPower"]
upower_object    = upower_service.object "/org/freedesktop/UPower"
upower_interface = upower_object["org.freedesktop.UPower"]
on_battery       = upower_interface["OnBattery"]
if on_battery
  puts "The computer IS on battery power."
  puts "The computer IS NOT on battery power."


  • Ruby 1.9.3 or 2.0


  • gem install ruby-dbus


Ruby D-Bus currently supports the following features:

  • Connecting to local buses.
  • Accessing remote services, objects and interfaces.
  • Invoking methods on remote objects synchronously and asynchronously.
  • Catch signals on remote objects and handle them via callbacks.
  • Remote object introspection.
  • Walking object trees.
  • Creating services and registering them on the bus.
  • Exporting objects with interfaces on a bus for remote use.
  • Rubyish D-Bus object and interface syntax support that automatically allows for introspection.
  • Emitting signals on exported objects.


See some of the examples in the examples/ subdirectory of the tarball. Also, check out the included tutorial (in Markdown format) in doc/Tutorial.md or view it online on https://github.com/mvidner/ruby-dbus/blob/master/doc/Tutorial.md .


Ruby D-Bus is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.