Apple Blog

Enabling the web server on OS X Mountain Lion

In OS X Lion, activating the web server was as easy as going through the sharing options in our preferences panel and activating it. With the arrival of Mountain Lion, this disappeared forcing its users to lift the service by using the terminal. We are going to show you which are those necessary commands and, in addition, we will show you a small surprise in form of graphic interface for all those reluctant to use the terminal.

The facilities we had in the pre-Mountain Lion version of OS X – the current version of the operating system – to activate our web server were abysmal. In order to make a system, I suppose, lighter, more stable and free of little used functionalities, this way of activating our web server disappeared from the face of the earth .

Enabling the web server on OS X Mountain Lion
Enabling the web server on OS X Mountain Lion

The way to activate it was as simple as going to System Preferences , then searching for Share and of all the services available, activating Web Share . And that’s it, we had everything ready to set up our website in local mode with all our space and bandwidth available to us.

But as we said, this, with OS X Mountain Lion disappeared. An action that used to require three simple clicks now requires us to work some magic with our dear and wonderful Terminal . For some, using the terminal will seem like a simple thing but for less experienced users, talking about terminals and commands can make them run away .

Around the clock with the terminal on OS X Mountain Lion

To do this, we need to access our terminal from Applications and then look up the Utilities part. Once the terminal is launched, we’ll type a little bit.

The possible commands to use are:

Starting the service

sudo apachectl start

Closing the process

sudo apachectl stop

Rebooting the Apache server

With these three basic commands, we have everything we need to run our web server and get it up and running . It should be noted that with these, when we turn off our computer, we will have to start the service again. To avoid this, and so that, when the computer is turned on again the service will be back up without the need to do anything , our command is as follows:

sudo defaults write SystemLibraryLaunchDaemonsorg.apache.httpd.plist Disabled -bool false

One more thing...

We were saving the best for last. For all those reluctant to use the terminal we bring you a little break in the form of the graphical interface . This is a plug-in that is added to our System Preferences with which we can activate our web server without having to resort to the Terminal .

I don't know exactly what this derisory option in the bowels of the operating system code of the bitten apple company would mean to get you killed this way but, was a way to save you that step through the terminal that so many and so many users avoid or having to install third party programs or add-ons. I haven't been able to check if this option will be available again in the next version of OS X, the so-called Mavericks, but I certainly wouldn't mind if it were to be added again .

Similar Posts