Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Whenever I try run a program like this "sudo mono Program.exe" or from a bash script. I get the error: mono: command not found.

I am running a VPS on CentOS 6 x64 bit.

Any ideas?

share|improve this question
4  
Well, mono is not in your PATH. How did you install it? –  slhck May 20 '12 at 18:13

2 Answers 2

Try the command

which mono

and see which path is returned. I'm not sure on how Mono is installed, but it's possible that you could be running the executable from your home directory, instead of somewhere like '/usr/bin'.

Try creating a new temporary user and executing mono then and see if you get the same error. It seems likely that the program isn't in a location that is included in your Path variable, so it's possible that it didn't install correctly and/or you or the installer didn't move the program to /usr/bin or /usr/local/bin

share|improve this answer
    
Ran the which command. Received this: /usr/local/bin/mono –  Skowt May 23 '12 at 17:18
1  
Change the path from /usr/local/bin/mono to /usr/bin/mono using the above answer. Here's the actual command for anyone else: mv /usr/local/bin/mono /usr/bin/mono Thanks very much Joe! :D –  Skowt May 23 '12 at 17:31
    
No problem :) Please, mark my answer as accepted if it's correct! –  Joe Bentley May 23 '12 at 18:32
    
Please do not do that with mv. If you later upgrade then you will have an old binary in /usr/bin and a newer one in /usr/local/bin/. Creating a softlink is a much better idea (though not the proper solution either). –  Hennes Nov 11 '14 at 13:11

You are running sudo mono Program.exe. Lets analyse this:

Cause:

As a user you have a path. You type 'sudo (something) and your shell find the sudo binary in your path and starts it.

Sudo causes you yo switch from your user to uid 0 (root) and the path which is set for this root user.

The latter path can be difference. In which case you get the 'file not found'.

Solution:

Either specify the full path (e.g. sudo /usr/local/bin/mono Program.exe) or add /usr/local/bin to the path for root.

share|improve this answer

Your Answer

 
discard

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.