# Error accessing X.Org commands with ruby shell command scripts

**URL:** <https://www.ruby-forum.com/t/error-accessing-x-org-commands-with-ruby-shell-command-scripts/172056>\
**Category:** Ruby\
**Created:** [July 14, 2009, 12:14am UTC](https://www.ruby-forum.com/t/error-accessing-x-org-commands-with-ruby-shell-command-scripts/172056 "2009-07-14T00:14:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gremio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8dc957/32.png) [@gremio](https://www.ruby-forum.com/u/gremio)\
**Post date:** [July 14, 2009, 12:14am UTC](https://www.ruby-forum.com/t/error-accessing-x-org-commands-with-ruby-shell-command-scripts/172056/1 "2009-07-14T00:14:06Z")

</div>

I am trying to run an [X.Org](http://X.Org) command from within ruby’s shell commands  
and am  
receiving “Command Not Found” errors.

As a walk through, I first start my X server (xvfb) and then start irb.  
In  
irb, if I type:

`ls -al`

I get the results I’d expect. But, if I type:

`DISPLAY=:1 firefox`

I receive “command not found” error for the entire command. At first, I  
thought that X11 permissions were preventing me from accessing such  
commands; but, I shouldn’t see the “command not found” error if this was  
the  
case. When I close irb and run the same command DISPLAY=:1 firefox, I  
get  
the results that I expect. I’ve tried this with several X11 commands  
from  
within irb and receive the same error. I thought about whether a ruby  
binding would fix this issue but I’m under the assumption that the shell  
scripts (I’ve tried ``, %x[], system) only run the raw command… i.e.  
`DISPLAY:=1 firefox` translates to DISPLAY:=1 firefox in the shell.

Would anyone know how I can access such a command from within a ruby  
shell  
command?

Any help would be greatly appreciated.

Thanks,  
Greg

---

<div class="post-metadata">

**Author:** ![gremio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8dc957/32.png) [@gremio](https://www.ruby-forum.com/u/gremio)\
**Post date:** [July 14, 2009, 12:21am UTC](https://www.ruby-forum.com/t/error-accessing-x-org-commands-with-ruby-shell-command-scripts/172056/2 "2009-07-14T00:21:07Z")

</div>

Gregory M. wrote:

> `DISPLAY=:1 firefox`

This works:

`env DISPLAY=:1 firefox`

---

<div class="post-metadata">

**Author:** ![gremio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8dc957/32.png) [@gremio](https://www.ruby-forum.com/u/gremio)\
**Post date:** [July 14, 2009, 12:26am UTC](https://www.ruby-forum.com/t/error-accessing-x-org-commands-with-ruby-shell-command-scripts/172056/3 "2009-07-14T00:26:58Z")

</div>

Joel, thank you.
