Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C#

How do you install compiler for c#?

I'm trying to install a compiler for C# - mono.

I visited this link:

http://www.mono-project.com/docs/getting-started/mono-basics/

I downloaded and installed it. I Then ran the commands on the terminal. But I keep getting

'-bash: csc: command not found'

What am I doing wrong?

I'm on a mac

Thanks

2 Answers

Use .NET Core

You can use mono on mac by downloading it via brew (package manager for mac), but I recommend using a new (late 2015) framework from Microsoft, which is called .NET Core. There are some differences between .NET and .NET Core but if you just want to build console apps, libraries or something like asp.net server backends, then you should use it. Something more graphical like the Windows Presentation Foundation (WPF) is not supported, yet.

If still like to use mono you can download it via brew. After you've installed brew install mono:

brew install mono

thanks, hakim

I'm trying to run the command mcs program.cs - but it just return an empty line. What am I missing?

Thanks

Compiler installed

Try running this

which mcs 

to make sure the mono compiler is installed (you should get a path to the compiler)

Compiler version

mcs --version

My version is 5.4.1.6(latest stable version)

mcs should not return anything at all

run mono to run program.exe