It turns out that the presence of SECURITYSESSIONID is not sufficient
for detecting the presence of a GUI under Mac OS X.  SECURITYSESSIONID
appears to only be set when the user has Screen Sharing enabled.
Disabling Screen Sharing and relaunching the shell showed that the
variable was missing, at least under Mac OS X 10.6.8.  As a result,
let's check for iTerm directly via TERM_PROGRAM.

Signed-off-by: John Szakmeister <>

On Sun, Mar 24, 2013 at 10:05:53PM +0100, Christian Couder wrote:
> Your patch looks good to me, and I cannot really test it as I don't have a 
> Mac.
> Could you just had some of the explanations you gave above to the
> commit message?

Here's an updated patch.  I also noticed that is
also trying to determine if a GUI is present by looking for
SECURITYSESSIONID as well.  I wonder if it would be better to
create a shell function in that the two scripts
could use?

-John | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ b/
index 1e82726..1ff5379 100755
--- a/
+++ b/
@@ -120,6 +120,7 @@ if test -z "$browser" ; then
        # SECURITYSESSIONID indicates an OS X GUI login session
        if test -n "$SECURITYSESSIONID" \
+               -o "$TERM_PROGRAM" = "" \
                -o "$TERM_PROGRAM" = "Apple_Terminal" ; then
                browser_candidates="open $browser_candidates"
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to