X11 forwarding not working with a Remote Login

I did the following on my iMac Pro 2017 running Ventura 13.4.1:


  • Installed XQuartz
  • Enabled Remote Login
  • Added `X11Forwarding yes` to /etc/ssh/sshd_config


I rebooted the computer and from a linux computer I can ssh into the mac using:

  • ssh -X imac1d


Commands work as expected, I get a command prompt and can execute various simple commands like `ls` or `vi file`. But if I try to execute `gitk .` in a git repository the X window appears on the mac not on the linux computer.


If I execute the `gitk .` in the same git repository on the mac itself it works fine. Also if I `ssh -X linux-computer` from the mac and then execute `gitk .` in a git repository on the linux computer that works fine.


Suggestions on what I can do?


iMac Pro (2017)

Posted on Jul 18, 2023 5:19 PM

Reply

Similar questions

30 replies

Jul 20, 2023 12:30 PM in response to winksaville

winksaville wrote:

I've got an "old" 2017 iMac pro could that be an issue?

Nope.

I actually installed all of Xcode, but after I deleted homebrew and macports so I should have all command line tools, I assume. But as u say something may be borked on my system. Also, gitk and git-gui didn't seem to be available on my system, maybe that's another indication I've done something else wrong.

I'm unfamiliar with gitk or git-gui. You'll have to install those on your own. Just so you know, if it isn't something that Apple builds and includes with the operating system or Xcode, then you can expect very poor Mac support. The open source folks have inventing completely new licensing strategies specifically to prevent Apple and Apple users from using their software. But those same people have no issues with Google and Facebook's usage.


I'm still unsure about what you've installed and in what order. I assume that Homebrew and MacPorts can be uninstalled, but it will require deep knowledge of both the operation system and those specific tools in order to accomplish it. But since people install those tools precisely because they don't have that kind of knowledge, usually the only solution is to erase the hard drive and reinstall the operating system. Note that if you take this option, you will not be able to restore from backup. Again, in theory, maybe you could restore only your user files and user accounts, but you will still need to be able to manually undo any changes to the hidden dot files in your home directory.

Finally, can you confirm for me that you can`ssh -X your-mac` from a Linux box and use gitk and git-gui? It would sure be nice to know what I'm trying to do is actually possible :)

Yes. I just tested it a couple of minutes ago in this thread: x forwarding issue - Apple Community So far, that person hasn't admitted to using Homebrew yet. But I specifically asked and they specifically didn't answer.


Jul 21, 2023 7:30 AM in response to BobHarris

I guess I'm a glutton for punishment, but this should work and I'm probably not the only person who's had this problem. And I don't like giving up :)


Anyway, after noodling on this overnight, I think the next step is to actually debug the problem, I'm a programmer. On first blush I believe I should enable debugging in the ssh server. I tried once before and apparently I need to modify `/System/Library/LaunchAgents/com.openssh.ssh-agent.plist`. But when I try to modify it with `sudo vi xxx` it can't be opened for writing and also where can I find what are the fields I need to modify to enable logging.

Jul 21, 2023 7:52 AM in response to winksaville

gitk and git-gui are not really part of git. If you want them, I encourage you to install them onto a default, working installation of macOS with the Command Line Tools. Since you have apparently reinstalled both MacPorts and Homebrew, that means yet another erase of the hard drive and reinstallation of the operating system, at least as far as I know.


You can download gitk from git://ozlabs.org/~paulus/gitk

You can download git-gui from https://github.com/prati0100/git-gui/


You do not need to download and rebuilt git, unless you want to for some reason. If you do want to do that, I recommend avoiding both MacPorts and Homebrew.


Jul 21, 2023 8:29 AM in response to etresoft

So I did erase and reinstall again last night and this morning finished setting up. The only other changes to the system was to change the mouse to left handed, turn off "Natural scrolling" and added Applications and Downloads to the Dock.


I then executed `mkdir -p ~/prgs/clones`, `cd ~/prgs/clones` and `git clone git://ozlabs.org/~paulus/gitk` which asked me to install the command line tools I said yes.


I then built gitk:


wink@Winks-iMac-Pro gitk % make
    * new Tcl/Tk interpreter location
    GEN gitk-wish
Generating catalog po/bg.msg
tclsh po/po2msg.sh --statistics --tcl po/bg.po -l bg -d po/
317 translated messages, 0 fuzzy ones, 0 untranslated ones.
Generating catalog po/ca.msg
tclsh po/po2msg.sh --statistics --tcl po/ca.po -l ca -d po/
307 translated messages, 0 fuzzy ones, 0 untranslated ones.
Generating catalog po/de.msg
tclsh po/po2msg.sh --statistics --tcl po/de.po -l de -d po/
307 translated messages, 0 fuzzy ones, 0 untranslated ones.
Generating catalog po/es.msg
tclsh po/po2msg.sh --statistics --tcl po/es.po -l es -d po/
184 translated messages, 46 fuzzy ones, 77 untranslated ones.
Generating catalog po/fr.msg
tclsh po/po2msg.sh --statistics --tcl po/fr.po -l fr -d po/
311 translated messages, 0 fuzzy ones, 0 untranslated ones.
Generating catalog po/hu.msg
tclsh po/po2msg.sh --statistics --tcl po/hu.po -l hu -d po/
277 translated messages, 18 fuzzy ones, 12 untranslated ones.
Generating catalog po/it.msg
tclsh po/po2msg.sh --statistics --tcl po/it.po -l it -d po/
274 translated messages, 17 fuzzy ones, 16 untranslated ones.
Generating catalog po/ja.msg
tclsh po/po2msg.sh --statistics --tcl po/ja.po -l ja -d po/
311 translated messages, 0 fuzzy ones, 0 untranslated ones.
Generating catalog po/pt_br.msg
tclsh po/po2msg.sh --statistics --tcl po/pt_br.po -l pt_br -d po/
279 translated messages, 17 fuzzy ones, 12 untranslated ones.
Generating catalog po/pt_pt.msg
tclsh po/po2msg.sh --statistics --tcl po/pt_pt.po -l pt_pt -d po/
311 translated messages, 0 fuzzy ones, 0 untranslated ones.
Generating catalog po/ru.msg
tclsh po/po2msg.sh --statistics --tcl po/ru.po -l ru -d po/
317 translated messages, 0 fuzzy ones, 0 untranslated ones.
Generating catalog po/sv.msg
tclsh po/po2msg.sh --statistics --tcl po/sv.po -l sv -d po/
311 translated messages, 0 fuzzy ones, 0 untranslated ones.
Generating catalog po/vi.msg
tclsh po/po2msg.sh --statistics --tcl po/vi.po -l vi -d po/
307 translated messages, 0 fuzzy ones, 0 untranslated ones.
Generating catalog po/zh_cn.msg
tclsh po/po2msg.sh --statistics --tcl po/zh_cn.po -l zh_cn -d po/
317 translated messages, 0 fuzzy ones, 0 untranslated ones.

And then executed `./gitk .` and it printed this deprecated warning:


wink@Winks-iMac-Pro gitk % ./gitk .
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.


And the window that pops up has "black" panes with no data:




I then close the window and on the Terminal it prints:


Error in startup script: invalid command name ".bar.view"
    while executing
".bar.view add radiobutton -label $viewname($n)  -command [list showview $n] -variable selectedview -value $n"
    (procedure "addviewmenu" line 4)
    invoked from within
"addviewmenu 1"
    invoked from within
"if {$cmdline_files ne {} || $revtreeargs ne {} || $revtreeargscmd ne {}} {
    # create a view for the files/dirs specified on the command line
    se..."
    (file "./gitk" line 12669)
wink@Winks-iMac-Pro gitk % 


@etresoft, any possibility you could try clone, compile and run gitk on your system to see if you have different behavior?



Jul 21, 2023 8:43 AM in response to BobHarris

I'm a programmer too. I've even work on different operating system kernels. That does not mean I want to play around with X11 based code 😱

I agree I've never written an X11 based app, and don't really want to, but git, git-gui and gitk are widely used tools and being able to use them one technique across systems and "remotely" is nice to have. I've used VNC previously, but as I recall it was slow especially when accessing via slow connections, but I might have to reconsider.


It seems to me Apple's not interested in making their systems compatible with other environments except when it's "mandatory". And making cross-platform developer life easy isn't a priority.

Jul 21, 2023 9:21 AM in response to BobHarris

I looked at TigerVNC and it seems only a source code license is available for macOS and compiling stuff on Mac has been a really poor experience! RealVNC seems fairly expensive and on top of that the lower cost variants only support cloud connections. It seems weird to have my data go through the cloud when the computer is in my garage or right next to me.


Currently the main things I want to be able to do is login via command line and use a few "gui" apps like git-gui, gitk and periodically I use meld.


Actually, what "native" git-gui, gitk and meld are available on macOS?


Answering my own question, maybe using vscode. I'm learning rust and I find vscode in vi mode quite good. It supports commits via the GUI and IIRC it can do gitk and meld diffing too. But to date I just been using git-gui,gitk,meld as they are more familiar, your thoughts?

Jul 21, 2023 4:37 PM in response to winksaville

winksaville wrote:

I agree I've never written an X11 based app, and don't really want to

I worked on X11 apps and wrote a few in the 90s.

git, git-gui and gitk are widely used tools and being able to use them one technique across systems and "remotely" is nice to have.

git is widely used. I've never heard of those other ones. Apparently one is based on TCL-TK. That's ancient - on all platforms.

I've used VNC previously, but as I recall it was slow especially when accessing via slow connections, but I might have to reconsider.

VNC is ancient with zero support. Performance is awful across the board. The only thing worse is the VNC experience. If you are trying to do any remote displays, Microsoft Remote Desktop is the only reasonable option. I run a server on my Linux server. That is what I primarily use when I need to connect remotely. I would never consider VNC or even X11.

It seems to me Apple's not interested in making their systems compatible with other environments except when it's "mandatory". And making cross-platform developer life easy isn't a priority.

Apple is totally not interested in any compatibility with other systems. Xcode is a cross-platform development environment, but those platforms are macOS, iOS, iPadOS, tvOS, watchOS, and now visionOS - and absolutely nothing else.


Actually, what "native" git-gui, gitk and meld are available on macOS?

What is "meld"?


I'm really not sure what exact problem you are having anymore. Are you unable to get basic X11 apps working? Or are you trying to port various esoteric Linux tools to the Mac? Why? If you want to spend some quality years porting various Linux tools from the 1990s to the Mac, you are certainly welcome to do so. No Mac user will ever use them. No Linux users will care.


Maybe you should reevaluate just what you are trying to accomplish. There is a wide array of all kinds of crazy tools, languages, and apps on Linux. But that's not necessarily a good thing. It's just how the community of job seekers works these days. But that's all it's about - finding a job. It is easier to invent a new language, or master a new tool, than it is to catch up to people who already know other tools. That same dynamic exists on Apple platforms, but the movement is vertical and temporal rather than horizontal. People would rather put iOS 17 APIs on their resume than make apps that run great on iOS 15 and 16.

Jul 21, 2023 6:50 PM in response to winksaville

winksaville wrote:

@etresoft, any possibility you could try clone, compile and run gitk on your system to see if you have different behavior?

I tried gitk. The colours are all screwed up. I installed some "Dracula" theme that made some parts of the UI show up. That interface is just atrocious.


git-gui wouldn't even run. It looks like it needs to be installed inside Xcode or something? I'm not doing that.


I recommend using git from the command line. Xcode has some git support. It can compare files. But beyond that, Xcode's a mess. Use the command line.

Jul 21, 2023 10:25 PM in response to BobHarris

Txs for trying seems to show it's not just me!


But, installing them homebrew both git-gui and gitk do work locally, they just don't work on an when an ssh client on a Linux box connects to a ssh server on Mac. I've duplicated that behavior with the gitk I compiled without homebrew. So that is a configuration or openssh problem. We'll see if I can figure it out :)


Thanks for the help!

Jul 22, 2023 7:52 AM in response to etresoft

So I shouldn't expect it to work, that's sad. But since XQuartz and git-gui and gitk work locally and xclock works locally and remotely I do expect git-gui and gitk to work remotely. It seems I might be the only person in the world who cares, but I'm guessing it can be fixed so I'm going to try. Hopefully you or others will continue to provide help, but if not I totally understand and appreciate the help everyone has provided!!


Cheers

Jul 23, 2023 11:04 PM in response to BobHarris

My Linux box is my primary work station and I'd like to have the capability to remotely log into my mac. I believe there is nothing keeping the mac running macos from being remotely operated using ssh and X11 and so I'm going to see if I can get it working.


I appreciate the help and advice you and others have given, I hope it continues.


I'll probably be posting to other topics specific to new issues I run into, so I'll probably only be answering questions or responding to comments people might. At a minimum I'll create one more post with the results of my journey.


Thanks,


Wink

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

X11 forwarding not working with a Remote Login

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.