Launching D-Bus

Shreevatsa R shreevatsa.public at gmail.com
Wed Jan 16 14:01:14 PST 2008


Hi,

My current understanding is this:
When a D-Bus-using program is started,
 (a) if DBUS_SESSION_BUS_ADDRESS is set, it uses that bus
 (b) else, it invokes dbus-launch --autolaunch. This will:
   (i) try to find the existing bus address in the X11 properties
   (ii) try to find the existing bus address in a file in ~/.dbus/session-bus
   (iii) if nothing is found, start a new session bus

Is this correct?

Now, I am on OS X, and not running X11. Even if I start dbus for one
shell manually, with
  dbus-launch --sh-syntax
and exporting the variables it prints, it only works for that shell
and doesn't set DBUS_SESSION_BUS_ADDRESS for other shells obviously,
and new D-Bus programs will end up spawning new dbus-daemons. I want
them to use the same session bus, and they don't seem to be finding
it.

If I try "dbus-launch --autolaunch=<somemachineid>", I get a
"Autolaunch error: X11 initialization failed." error. My understanding
is that D-Bus doesn't really require X11, but it is failing here
because it is trying to set (or read) some X11 properties, for (b)(i).

(b)(ii) seems promising, but I don't know how to use it, because none
of these invocations seem to create any files in ~/.dbus/session-bus/.

So my question is: How do I launch dbus and have the session bus
address available to all programs that are launched later?

[I *could* put something in my *shrc files to run
dbus-cleanup-sockets, then look for files named /tmp/dbus-*, then set
the DBUS_SESSION_BUS_ADDRESS variable with some string manipulation...
I'm hoping there is a more "proper" way.]

Thanks,
Shreevatsa


More information about the dbus mailing list