Opened 8 months ago

Last modified 8 months ago

#69672 new defect

git 2.44.0: gitk doesn't run, "no display name and no $DISPLAY environment variable"

Reported by: gwerbin (Greg Werbin) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.9.3
Keywords: Cc:
Port: git

Description (last modified by ryandesign (Ryan Carsten Schmidt))

I get the following error when I run /opt/local/bin/gitk on MacOS 12.7 (M1 ARM):

% /opt/local/bin/gitk

application-specific initialization failed: no display name and no $DISPLAY environment variable
Error in startup script: no display name and no $DISPLAY environment variable
    while executing
"load /opt/local/lib/libtk8.6.dylib"
    ("package ifneeded Tk 8.6.14" script)
    invoked from within
"package require Tk"
    (file "/opt/local/bin/gitk" line 10)

Not sure if this is related to #62988.

Change History (5)

comment:1 Changed 8 months ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

Not sure if this is related to #62988.

Doesn't look like the same error message.

What X server do you have installed? What does echo $DISPLAY say?

I'm assuming that you have an X server installed. If you don't, install ours by running sudo port install xorg-server and following the instructions it prints.

comment:2 Changed 8 months ago by jmroot (Joshua Root)

Or you can install tk with +quartz.

comment:3 Changed 8 months ago by gwerbin (Greg Werbin)

port install tk +quartz did the job, thanks!

I was hoping to avoid running an X server on my Mac, I did that in the past for programs like Inkscape and always found it less than enjoyable to have a whole extra window system overlaid on the existing one.

For comparison, the Homebrew "git-gui" package also ships gitk, which seems to work fine without an X server installed or any special Tk options. Is there something fundamentally different about the Macports and Homebrew packages? Is the difference that they're possibly shipping a Quartz-enabled Tk build by default? They use the --enable-aqua=yes build option: https://github.com/Homebrew/homebrew-core/blob/2e7221e9161b7d175c472e7044be9e53893b72ba/Formula/t/tcl-tk.rb#L89

Feel free to mark this as closed. However I would consider this a request to add a mention of the +quartz recommendation in the docs somewhere, for running Tk-based applications.

comment:4 Changed 8 months ago by ryandesign (Ryan Carsten Schmidt)

Sounds like you've already found your answer. Homebrew uses --enable-aqua=yes unconditionally. We only use it if you request the +quartz variant.

We used to use +quartz by default in the tk port. It was changed to +x11 in 2015 for reasons explained in the commit message.

Moving to +quartz as the default for all ports is tracked in #60511.

Where in the documentation would be a good place to mention the +quartz variant, do you think? Anyone can submit improvements to the documentation, by the way.

comment:5 Changed 8 months ago by ryandesign (Ryan Carsten Schmidt)

…but users are expected to run port variants to discover what variants are available for the ports they want to install.

% port variants tk
tk has the variants:
   quartz: Enable native macOS graphics support
     * conflicts with x11
   universal: Build for multiple architectures
[+]x11: Enable X11 support
     * conflicts with quartz
Note: See TracTickets for help on using tickets.