1

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?

1
  • 4
    Well, mono is not in your PATH. How did you install it?
    – slhck
    May 20, 2012 at 18:13

2 Answers 2

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

3
  • Ran the which command. Received this: /usr/local/bin/mono
    – Skowt
    May 23, 2012 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, 2012 at 17:31
  • 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, 2014 at 13:11
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .