I'm trying to run gedit in cygwin, but receiving error
Asked Answered
U

2

7

I'm trying to run some normal text editor in cygwin (version 2.4.1(0.293/5/3)). I've really disappointed and frustrated with emacs :( So I downloaded and installed gedit as a part of cygwin package, but when I'm trying to run it, I receive:

$ gedit

Unable to init server: Could not connect to 127.0.0.1: Connection refused

(gedit:8196): Gtk-WARNING **: cannot open display:

I understand that it can be somehow connected with security issues (it runs on multiuser win10 PC), but I cannot find out how to solve it....

Please help!

Unknot answered 24/3, 2016 at 20:42 Comment(3)
That's karma punishing you for giving up on Emacs.Norton
That's karma pushing me to install ubuntu :)Unknot
Are you ssh'd into this server? If so you need to enable "X forwarding" in your ssh client. But if you're looking for a no-nonsense editor that will actually work, use nano.Continuum
W
16

I was having the same problem and was able to solve. Your case may be the same

  1. install Cygwin/X

  2. open cygwin and start x11 server by typing

    startxwin >/dev/null 2>&1 &

  3. set DISPLAY environment variable as explained here by typing

    export DISPLAY=:0.0

  4. Start gedit normally

Wyatan answered 31/3, 2016 at 17:53 Comment(4)
Still getting this error : Unable to init server: Could not connect to 127.0.0.1: Connection refused (gedit:8108): Gtk-WARNING **: cannot open display: :0.0Heatstroke
Do you have the package xinit installed? Try to start startxwin without redirecting anything (without the >/dev/null 2>&1 &) parts and see if it works. If it does not, check if xinit is installed and install it if it is not.Wyatan
I can confirm that this solution works if you follow the instruction and install/configure the required packages.Ashliashlie
Thanks I just needed to run startxwin >/dev/null 2>&1 &Bludge
S
0

This (startxwin >/dev/null 2>&1 & export DISPLAY=:0.0) work for temporary, not permanent. It is needed to type each time I close terminal.

Shockey answered 22/4, 2018 at 5:4 Comment(1)
You have to add it to ~/.bashrcFawcett

© 2022 - 2024 — McMap. All rights reserved.