LoginSignup
0
0

ターミナルからXが立ち上がらない問題【macOS】

Posted at

1. 問題点

なんでかわからないけど、macportsでinstallしたときは出来ているのに、何かのタイミングでmacのターミナルからXが立ち上がらない問題が発生して、何度か初期化するという暴挙に出た。
にも関わらず、再び問題が発生した。
例えば

terminal
$ grads 

Grid Analysis and Display System (GrADS) Version 2.2.1
Copyright (C) 1988-2018 by George Mason University
GrADS comes with ABSOLUTELY NO WARRANTY
See file COPYRIGHT for more information

Config: v2.2.1 little-endian readline grib2 netcdf hdf4-sds hdf5 opendap-grids geotiff shapefile
Issue 'q config' and 'q gxconfig' commands for more detailed configuration information
Landscape mode? ('n' for portrait):  
GX Package Initialization: Size = 11 8.5 
Error in GXSTRT: Unable to connect to X server

gradsを立ち上げるとX serverに繋がらねえと出てくる。
画像ビュアーeogを立ち上げると

terminal
$ eog fig.png 

(eog:17280): Gtk-WARNING **: 21:53:22.389: cannot open display:

おおおお。cannot open displayと出るではないか。

※一応改めて確認すると、macportsでinstallしたxorg-serverを使用している。

2.解決法

DISPLAY環境変数を指定してやればいいので、x11からターミナルを立ち上げ、DISPLAYを確認する。

xterm
$ echo $DISPLAY
:3

おおお。

ターミナルに戻って

terminal
$ echo $DISPLAY

$ export DISPLAY=":3"
$ echo $DISPLAY
:3

と入れてやる。

すると、ターミナルからXが立ち上がるようになる。

terminal
$ grads

Grid Analysis and Display System (GrADS) Version 2.2.1
Copyright (C) 1988-2018 by George Mason University
GrADS comes with ABSOLUTELY NO WARRANTY
See file COPYRIGHT for more information

Config: v2.2.1 little-endian readline grib2 netcdf hdf4-sds hdf5 opendap-grids geotiff shapefile
Issue 'q config' and 'q gxconfig' commands for more detailed configuration information
Landscape mode? ('n' for portrait):  
GX Package Initialization: Size = 11 8.5 

やったー。

3. 最後に

初期化する前に、確認しましょう。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0