Opened 4 years ago

Closed 3 years ago

#62036 closed defect (fixed)

git @2.30.0: gui and gitk commands don't work: Error in startup script: couldn't connect to display ":0"

Reported by: mohd-akram (Mohamed Akram) Owned by: ci42
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: git

Description

I get this error when running git gui:

macOS 11 or later required !
error: git-gui died of signal 6

And when running gitk:

application-specific initialization failed: couldn't connect to display ":0"
Error in startup script: couldn't connect to display ":0"
    while executing
"load /opt/local/lib/libtk8.6.dylib Tk"
    ("package ifneeded Tk 8.6.10" script)
    invoked from within
"package require Tk"
    (file "/opt/local/bin/gitk" line 10)

They were working fine, seemed to have started happening after a recent update.

Change History (22)

comment:1 Changed 4 years ago by kencu (Ken)

There is/was a bug in the macports installation script that was sticking ":0" as a DISPLAY in .zprofile or .profile.

If you have that, remove it, log out / reboot and then log in again, and see if that fixed it.

comment:2 Changed 4 years ago by mf2k (Frank Schima)

Cc: ci42 removed
Owner: set to ci42
Status: newassigned

comment:3 in reply to:  1 Changed 4 years ago by mohd-akram (Mohamed Akram)

Tried it, didn't work.

Replying to kencu:

There is/was a bug in the macports installation script that was sticking ":0" as a DISPLAY in .zprofile or .profile.

If you have that, remove it, log out / reboot and then log in again, and see if that fixed it.

comment:4 Changed 4 years ago by kencu (Ken)

OK. You should never see this error again then "Error in startup script: couldn't connect to display ":0""

So what error do you see now?

comment:5 Changed 4 years ago by mohd-akram (Mohamed Akram)

git gui has the same error, gitk now has this:

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 Tk"
    ("package ifneeded Tk 8.6.10" script)
    invoked from within
"package require Tk"
    (file "/opt/local/bin/gitk" line 10)

comment:6 Changed 4 years ago by kencu (Ken)

I assume you have xorg-server installed?

comment:7 in reply to:  6 Changed 4 years ago by mohd-akram (Mohamed Akram)

Installing xorg-server does fix gitk, but the window looks very odd because it's using the X11 backend of Tk. The issue seems to be that Apple broke Tk in Big Sur, according to this, and git-gui is hardcoded to use Apple's version, which can be fixed with a patch. MacPorts should not use Apple's version, but rather its own. Also, the default Tk variant should change to +quartz to match the Apple provided version, which doesn't require X11 and looks much better.

The workaround in the meantime is to do:

sudo port install tk +quartz
sudo cp /opt/local/bin/wish /opt/local/share/git-gui/lib/Git\ Gui.app/Contents/MacOS/Wish

Replying to kencu:

I assume you have xorg-server installed?

comment:8 Changed 4 years ago by kencu (Ken)

the whole +x11 vs +quartz thing is a deep discussion. For years and years, +quartz had only spotty coverage. Even now, there are quite a few ports that assume an +x11 system (ie Linux) and they just plain won't build +quartz.

The creators of upstream software usually say they have few to no +quartz users, and zero developers who ever build their software +quartz. Of course, that is a chicken-and-egg thing.

Homebrew has outlawed all +x11 software, and you are starting to see more +quartz possibly because of that. Unfortunately, there are often homebrew-only chunks of code added to the meson build files, etc, to make that work, so it's not much less effort.

I like +x11 myself, as it has few headaches -- it usually builds exactly like the linux software. But +quartz, when it's done right, is more mac-like. But somebody needs to code in all the menu bar integration, etc, and actually make it work.

Dave, who runs 99% of the gtk stuff on MacPorts, has a lot of software to maintain, and he has said that the x11 stuff is his preference, and he doesn't appear to spend any time making the +quartz stuff work.

A few people have come along and pushed hard for MacPorts to switch "en masse" to +quartz, and damn the torpedoes, just do it. Whatever breaks either then gets thrown out, or fixed.

Last edited 4 years ago by kencu (Ken) (previous) (diff)

comment:9 Changed 4 years ago by kencu (Ken)

I'm going to close this ticket as "works for me". MacPorts has previously discussed making xorg-server a runtime dependency for x11 software, and for whatever reason there was tremendous blowback about that, so users are on their own to figure out that x11 software won't work without an x11 server.

Version 0, edited 4 years ago by kencu (Ken) (next)

comment:10 Changed 4 years ago by kencu (Ken)

Resolution: worksforme
Status: assignedclosed

comment:11 Changed 4 years ago by mohd-akram (Mohamed Akram)

I'm not sure what the previous discussions were about, but this issue is only related to Tk, not GTK or other ports. As mentioned here, all popular Tk distributions use the "Aqua Cocoa" version which uses native macOS widgets. This includes ActiveTcl, Apple-supplied Tk, Homebrew, and the Tk that's bundled with Python. Either way, this is for another ticket. This ticket should remain open because git-gui does not use MacPorts Tk in the first place.

comment:12 Changed 4 years ago by kencu (Ken)

Summary: git @2.30.0: gui and gitk commands don't workgit @2.30.0: gui and gitk commands don't work: Error in startup script: couldn't connect to display ":0"

comment:13 Changed 4 years ago by kencu (Ken)

OK. I thought the issue of the ticket, "Error in startup script: couldn't connect to display ":0"" issue was fixed here, but if not, then I'll reopen this.

Last edited 4 years ago by kencu (Ken) (previous) (diff)

comment:14 Changed 4 years ago by kencu (Ken)

Resolution: worksforme
Status: closedreopened

comment:15 in reply to:  11 ; Changed 4 years ago by kencu (Ken)

Replying to mohd-akram:

This ticket should remain open because git-gui does not use MacPorts Tk in the first place.

It certainly looks like it does:

"load /opt/local/lib/libtk8.6.dylib Tk"

comment:16 in reply to:  15 Changed 4 years ago by mohd-akram (Mohamed Akram)

Where is this string? The wish binary used by git-gui is copied from /System/Library, hence why replacing it in my workaround makes it work.

Replying to kencu:

Replying to mohd-akram:

This ticket should remain open because git-gui does not use MacPorts Tk in the first place.

It certainly looks like it does:

"load /opt/local/lib/libtk8.6.dylib Tk"

comment:17 Changed 4 years ago by mohd-akram (Mohamed Akram)

gitk is using MacPorts Tk. git-gui, a different program that also comes with git isn't. I mentioned the two different error messages in the issue.

comment:18 Changed 4 years ago by kencu (Ken)

Oh, I guess you have two different things going on with two different programs in the same ticket, but with (it appears?) totally different problems.

You're right, if that is the case, I did not notice you had two different issues going on.

comment:19 Changed 4 years ago by mohd-akram (Mohamed Akram)

Apple Tk has been fixed in macOS Big Sur 11.2 so this ticket can be closed now.

comment:20 Changed 3 years ago by gagarine (Simon)

Apple tk on macOS Big sur 11.3.1 has a deprecation warning: DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.

I tried to install tk using macports. I have git from macports too. It do not works

$ sudo port install tk git
$ gitk
application-specific initialization failed: couldn't connect to display ":0"
Error in startup script: couldn't connect to display ":0"
    while executing
"load /opt/local/lib/libtk8.6.dylib Tk"
    ("package ifneeded Tk 8.6.11" script)
    invoked from within
"package require Tk"
    (file "/opt/local/bin/gitk" line 10)
Last edited 3 years ago by gagarine (Simon) (previous) (diff)

comment:21 Changed 3 years ago by mohd-akram (Mohamed Akram)

You can just silence that warning as they say by adding export TK_SILENCE_DEPRECATION=1 to your shell profile. You have three options basically, do either of them:

  • sudo port uninstall tk or
  • sudo port install tk +quartz or
  • sudo port install tk xorg-server

I use the first.

comment:22 Changed 3 years ago by mohd-akram (Mohamed Akram)

Resolution: fixed
Status: reopenedclosed

In 4bfc47deb6919ff5a90fdf8c6b90317586324322/macports-ports (master):

git: do not bundle tk for gui

Fixes: #62036
Fixes: #64249

Note: See TracTickets for help on using tickets.