In this post I will write about setup and configure mono on OS X. I need mono on my Mac since C# is one of my favorite programming language ;)
First of all let’s download Mono SDK and MonoDevelop. The order installation is Mono SDK first then MonoDevelop. The installation of Mono SDK and MonoDevelop should be easy by following the installation wizard.
When the installation finish, open terminal :
# mono version
mono -V
We should get info about the version of mono installed in our machine.
Try to create an ASP.NET Web Application project by selecting menu :
File > New > Solution. Select C# > ASP.NET > Web Application
Click Run > Run With > Mono Soft Debugger for ASP.NET
ASP.NET on Apache Web Server
To run ASP.Net on Apache web server, we need Mod mono module. It is an Apache 2.0/2.2 module that provides ASP.Net support for Apache web server. The steps installation are :
Install Apache web server. The steps for OS X Mountain Lion can be found in my previous post
Install Xcode, OS X development tool. It’s free and can be downloaded via App Store. We need it to compile mod mono installation source
Download Mod mono source installation here. At the time of write this article I use mod_mono-2.10.tar.bz2
Install mod mono module. Open terminal
# mod mono installationmkdir ~/modmono
cp ~/Downloads/mod_mono-2.10.tar.bz2 ~/modmono
cd ~/modmono
tar xzf mod_mono-2.10.tar.bz2
cd mod_mono-2.10
./configure
make
sudo make install
sudo cp /etc/apache2/mod_mono.conf /etc/apache2/other
Add mod_mono.conf reference in httpd.conf
sudo vi /etc/apache2/httpd.conf
Add the following code at the end of httpd.conf
Include /etc/apache2/mod_mono.conf
Create a web directory with the path ~/Projects/Mono/TestMonoApache/TestMonoApache/
In that directory create an index.aspx file
<center>mod_mono is working:<%=System.DateTime.Now.ToString()%></center>
Add an Apache configuration file for mono.
sudo vi /etc/apache2/mod_mono.conf
Add the following line at the end of mod_mono.conf
Alias /testmono "/Users/username/Projects/Mono/TestMonoApache/TestMonoApache/"
<Directory"/Users/username/Projects/Mono/TestMonoApache/TestMonoApache/">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
AddMonoApplications default "/testmonoapache:/Users/username/Projects/Mono/TestMonoApache/TestMonoApache/"
<Location/testmonoapache>
SetHandler mono
</Location>
Restart apache server with command :
sudo /usr/sbin/apachectl restart
Open browser and hit http://localhost/testmonoapache/index.aspx
Cool, now our apache web server can receive request for asp.net page. Thanks for reading and see you in the next post :)