run x11 applications from Apple’s terminal

If you use X11, here is a nice tip (here is the source of that tip): To to run X11 apps direct­ly from Apple’s Terminal.app, add the fol­low­ing line to your bashrc file:

[[ ‑z $DISPLAY ]] && export DISPLAY=“:0.0”

Then restart Ter­mi­nal (or type “source /etc/bashrc”) for the changes to take effect.

Note: I edit­ed my sys­tem-wide bashrc file under /etc/bashrc (for some rea­son, edit­ing my user .bashrc file did­n’t do the trick). You’ll need admin­is­tra­tive priv­i­leges to edit this file; if you do, just type “sudo pico /etc/bashrc” at the ter­mi­nal prompt, and enter your pass­word when prompt­ed. Copy and paste the line above into the file, then press ctrl‑x to save.

There is also a more cum­ber­some (but strait-for­ward) way to open X‑11 apps from the Apple ter­mi­nal: When­ev­er run­ning the app, pre­cede the appli­ca­tion name with “open-x11”. How­ev­er, this can be a pain if you open X11 apps frequently.

Tech­no­rati Tags: , ,

2 thoughts on “run x11 applications from Apple’s terminal”

  1. Just per­son­al pref­er­ence, real­ly (Apple’s ter­mi­nal is more eas­i­ly cus­tomiz­able, has trans­paren­cy options, and is copy & paste friend­ly), although I some­times alter­nate between it and aterm. It’s good to have the option, at any rate.

Leave a Reply