Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Ubuntu 12.04 64 bits. I've recently installed the ruby1.9.1 package and the wx-ruby gem using :

sudo gem install wxruby-ruby19

in order to install the ruby1.9 compatible version.

So I wrote a ruby script called fenetre_wx.rb (which has already execution right)

#!/usr/bin/env ruby
require "wx"
include Wx

class FenetrePrincipale < App
    def on_init
  , -1, "My app in Ruby with WxRuby",,-1),,480)).show

No problem when I call

 ruby fenetre_wx.rb

But when I do :


I get the following error :

bash: ./fenetre_wx.rb: Aucun fichier ou dossier de ce type

Which can be translated by :

"No file nor directory of this type" :

I've got the French version, but maybe my translation is wrong, so I left the original text.

Does someone know what's wrong ? Thanks in advance.

share|improve this question
Check that the ruby version used in both cases is the same one. which ruby vs env | grep ruby – bbaja42 Oct 15 '12 at 11:32
You're right : whereas "which ruby" gave me 'usr/bin/ruby' ; "env | grep ruby" did not give me anything. So how can I correct it ? I've replaced the shabang with /usr/bin/ruby : but no change. – loloof64 Oct 15 '12 at 11:43
up vote 1 down vote accepted

Please make sure that line endings are unix style in your source file and the source doesn't start with the byte order mark. Byte order mark is a three hex number sequence ( 0xef 0xbb 0xbf) which are invisible through any editor. refer to this StackOverflow question for a solution to byte order mark problem. and use dos2unix for line endings conversion.

share|improve this answer
Thank you very much : I first used "sed -i '1 s/^\xef\xbb\xbf//' *.rb" then "dos2unix *.rb", and the problem has been solved :) Maybe the problem comes from my Geany editor configuration (though it is in UTF-8) – loloof64 Oct 15 '12 at 12:26
You're welcome :) If you program with Windows based tools, find an option that lets you edit unix style, I know that Notepad++ is capable of this. And vim/emacs are available on windows. – user91091 Oct 15 '12 at 12:29
I know what went wrong : I edited the source from a virtual box windows guest, before reusing it in Linux. – loloof64 Oct 15 '12 at 12:32

As you mentioned in the comments, replace

#!/usr/bin/env ruby


share|improve this answer
That's done : but I still get the same error . – loloof64 Oct 15 '12 at 11:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.