12

I just started to develop website with mono+asp.net mvc2 on mac osx but I am quite new to mono and mac.

I have got things working from MonoDevelop. My website is running ok with XSP when I run it from MonoDevelop.

Now, I am trying to test it from Apache server, but I don’t know how to set things up. Some instruction I can found are all very old or incomplete. I tried a few of them, but none worked.

Could anyone please help me out?

frostred
  • 183
  • 2
  • 8
  • I'm having the same problem. Mono 2.10.2 and XSP2 2.10.2.0 confirmed working on my Mac with OSX 10.6.7, Apache 2.2.17. None of the instructions I've found for mod-mono cover OS X, they are all specific to various Linux distros. I just want ASP.NET working in my existing virtual hosts running under Apache. – richardtallent Jun 19 '11 at 21:36

2 Answers2

5

The best way to install mod_mono on OS X is from source. To do this there are a couple steps.

First, make sure you've installed XCode (which can be found on the DVD or the 2nd CD that came with the machine or the App Store) which will provide you with gcc and the rest of the standard toolchain.

Most of the normal in-between steps can be skipped, assuming you've already installed Mono and MonoDevelop from their stable release packages. If you encounter an error later on, you'll want to install updated versions of XSP and Mono and try again.

Next, download the latest stable release of mod_mono, extract the contents of the archive (by double clicking on the icon) and follow steps 1, 2 & 3 in the INSTALL file, and you should be good to go. This entire process took about ~5 minutes to get up and running :)

TkTech
  • 4,729
  • 1
  • 24
  • 32
  • That got me close--guess I just figured either (a) mod_mono was already included, or (b) there's no freaking way the make script would work OOTB on OSX. It did compile, but to get it to work, I had to also edit my VirtualHost entry in the httpd.conf to add lines for MonoPath, AddHandler (couldn't use SetHandler, I need PHP to run too), MonoServerPath, and AddMonoApplications. Once that was done, it appears everything is running! – richardtallent Jun 24 '11 at 06:15
  • @richardtallent: All of the individual mono projects can be compiled from source very easily on OS X :) It's usually their dependencies that are the real pain to build, and you require an existing install of at least mono-core to bootstrap the build. – TkTech Jun 24 '11 at 12:13
3

I am a novice with mono but followed some instructions. I downloaded and installed everything from here: http://www.go-mono.com/mono-downloads/download.html

To get Apache to work with mod_mono.so I downloaded source from this page: http://download.mono-project.com/sources/mod_mono/

You have to compile it. I went into the unpacked directory and wrote this in termminal:

./configure --prefix=/usr
make
sudo make install

This puts the mod_mono.so in correct Apache dir and the mod_mono.conf file. To include it you must add this to your httpd.conf (I put it at the end of the file):

 # mod_mono_configuration                                                  
 Include /etc/apache2/mod_mono.conf
 MonoServerPath /Library/Frameworks/Mono.framework/Versions/Current/bin/mod-mono-server2
Asle
  • 767
  • 2
  • 8
  • 22
  • Unfortunately, since macOS High Sierra, it seems that it is no longer possible to compile and install additional modules for the Apple-provided Apache httpd server. This is because a tool named `apxs` is no longer included. – Otto G Aug 01 '18 at 08:53
  • @OttoG (and others finding this later), this is true - this blog post was helpful in getting around that (basically, installing apache2 from homebrew instead of using the built-int one: https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions – brazilianldsjaguar Aug 27 '18 at 18:00