Posts Tagged ‘websharper’

I recently acquired a Mac and wanted to try out developing a pet project of mine on my new machinery. It’s a WebSharper project(*). This post however is not about WebSharper but about installing xsp

xsp is a lightweight web server, that can be used to server ASP.NET web sites. Installing xsp is a little more work than just fetching a package. You will need to clone it from github

git clone https://github.com/mono/xsp.git

and then change to the directory of xsp and run the below command

./autogen.sh

If you get this error

aclocal is not installed, and is required to configure

It’s because you don’t have the required tools installed. If you didn’t get that error, then you can probably skip all the way to configuring xsp.

Installing the required tools

It’s pretty straight forward to install the required tools. You will simply have to run a series of commands. One for each tool being installed. (These are tools often used for building open source projects, that used to be installed together with Xcode, but are no longer part of that installation.)
After trying to install the tools manually where I kept getting missing dependencies errors I went the homebrew way. If you haven’t already installed homebrew don’t fret. Installing homebrew is a one command exercise:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

After installing homebrew we can get to installing the required tools

brew install autoconf
brew link --overwrite autoconf

If the link command fails with an error stating that a given path is not writable, then do as follows, before repeating the linking

chown -R yourusername unwritableDirectoryPath
chmod -R u+w /usr/local

When you have successfully linked autoconf, then proceed with the installation of the required tools/libraries

brew install automake
brew install pkg-config
brew install mono

That should have installed the prerequisite, and you should now be able to follow the installation instructions on the xsp homepage. Start by running

./autogen.sh

again. This time there should be no errors.

To complete the installation, run the below commands

./Configure --prefix=/usr
make 
make install

And with all that under our belt, you should now be able to navigate to the root of your website and execute the command

xsp4 --port=####

This will start a webserver listening on the specified port (if you just want the default port 8080 you can omit the –port option)
*) WebSharper itself is an awesome tool for building web sites. The only real problem I’ve had is the fact that it’s not as widely used as other tools and therefore lacks on the documentation/sample code side. However, it does reduce the amount of work I’ve had to do to accomplish my work regardless of the lack of stackoverflow Q&As.

Advertisement