dbus-launch
Start a new D-Bus session bus instance
SYNOPSIS
dbus-launch [OPTION...] [-- [PROGRAM [ARGS...]]]
PARAMETERS
--autolaunch=<machine-id>
Print autolaunch address for given machine ID and exit.
--binary=<filename>
Use specified binary instead of dbus-daemon.
--close-stderr
Close stderr when forking the daemon.
--config-file=<filename>
Pass config file to daemon's --config-file.
--desktop=<desktop>
Pass desktop identifier to daemon's --desktop.
--exit-with-session
Exit when session bus exits.
--exit-with-x11
Exit if DISPLAY vanishes (e.g., X server exits).
--exit-with-xsession
Exit if USER_XSESSION_RUNNING unsets.
--sh-syntax
Print DBUS_SESSION_BUS_ADDRESS in Bourne shell syntax.
--version
Print version and exit.
DESCRIPTION
D-Bus is a message bus system for interprocess communication (IPC) in Linux, enabling applications to interact seamlessly.
dbus-launch starts a new dbus-daemon session bus if none exists, configures it with standard settings, and exports environment variables like DBUS_SESSION_BUS_ADDRESS and DBUS_SESSION_BUS_PID.
Primarily used in user sessions via shell scripts (e.g., .xinitrc, login managers), it ensures desktop apps like notifications, file managers, and power daemons can communicate. Invoke as eval $(dbus-launch --sh-syntax) to set variables, or dbus-launch some-program to run a program with the bus.
If a bus already runs (checked via DBUS_SESSION_BUS_ADDRESS), it reuses it without starting a new one, preventing duplicates.
In modern systems (GNOME, KDE), PAM or session managers auto-start the bus, reducing dbus-launch necessity. Still vital for custom X sessions, containers, or headless setups needing per-session D-Bus.
CAVEATS
Deprecated in D-Bus 1.12+: Session buses auto-start; prefer dbus-run-session for new scripts.
Does not daemonize by default; use with --exit-with-session for cleanup.
USAGE EXAMPLE
eval $(dbus-launch --sh-syntax) to set vars.
dbus-launch --exit-with-session xterm to run program with bus.
ENVIRONMENT
Exports DBUS_SESSION_BUS_ADDRESS (address), DBUS_SESSION_BUS_PID (PID), DBUS_SESSION_BUS_WINDOWID (optional XID).
HISTORY
Introduced ~2002 in D-Bus 0.30 (freedesktop.org project by Havoc Pennington et al.) for GNOME/KDE IPC standardization. Evolved through D-Bus 1.x; largely obsoleted by auto-activation in systemd-logind/PAM integrations post-2017.
SEE ALSO
dbus-daemon(1), dbus-run-session(1), dbus-send(1), dbus-monitor(1)


