How to determine the dbus address on OSX/MacPorts OR How to make MacPorts-dbus work with non-MacPorts qt5-install

Ian Wadham iandw.au at gmail.com
Fri Aug 22 16:40:42 PDT 2014


Hi David and Marko,

On 23/08/2014, at 8:37 AM, David Evans wrote:
> On 8/22/14 12:41 PM, Marko Käning wrote:
>> how can I determine the dbus address of the session dbus started by launchd?
>> 
>> The environment contains only DBUS_LAUNCHD_SESSION_BUS_SOCKET:
>>>> DBUS_LAUNCHD_SESSION_BUS_SOCKET=/tmp/launch-adIO4f/unix_domain_listener
>> 
>>>> 
>> So, the question is, can I query the session dbus somehow in order to obtain
>> the dbus address which I could then use to set DBUS_SESSION_BUS_ADDRESS in
>> my environment?
> Marko,
> 
> You can form the DBUS_SESSION_BUS_ADDRESS as follows:
> 
> export DBUS_SESSION_BUS_ADDRESS='unix:path='$DBUS_LAUNCHD_SESSION_BUS_SOCKET
> 
> or, in your case,
> 
> unix:path=/tmp/launch-adIO4f/unix_domain_listener
> 
> The usual way to get the session bus address programatically is to the
> GDBus API provided by GIO in glib2.
> In MacPorts, this has been patched to work as I have described.

> 
> See the definition of get_session_address_macports_specific (GError
> **error) in
> files/patch-get-launchd-dbus-session-address.diff.

As a rider to that, Qt has several classes related to DBus and the
QDBusConnection class has methods QDBusConnection::sessionBus()
and QDBusConnection::systemBus() to get access to the most commonly
used buses.  The Qt methods would be used inside KDE and Qt apps.

Cheers, Ian W.




More information about the macports-dev mailing list