Solution for “_X11TransSocketINETConnect: Can’t get address for localhost”
To the public knowledge, this is caused by missing
127.0.0.1 localhost
line in your /etc/hosts
file.
However, for some applications, even if you have that line, you will still get this error. Or what if you do not have access/privilege to modify the /etc/hosts file?
There is still a work around:
Suppose the affected program is named cccccc
you may make a shell script like:
$!/bin/sh
( DISPLAY=`echo $DISPLAY | sed -e ‘s/localhost/127.0.0.1/g’`; export DISPLAY;\
cccccc
)
and make this file executible.
Then when you execute this file, it will replace the hostname localhost to the rightful IP 127.0.0.1, such that your program will not have to do name look up for localhost.
After your program is ended, this script will automatically void the modification to the $DISPLAY parameter, so that your other applications won’t be affected.