New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Activating Apache on Mountain Lion and Mavericks

From: Installing Apache, MySQL, and PHP

Video: Activating Apache on Mountain Lion and Mavericks

In OS X, 10.8, Mountain Lion, Apple If you go to System Preferences, and from there I'll close the System Preferences application, and I'll go to Terminal.

Activating Apache on Mountain Lion and Mavericks

In OS X, 10.8, Mountain Lion, Apple changed how you managed the Apache HTTP server. Apache is still included with the operating system, but the user interface changed significantly. The following steps work in Mountain Lion, and in the more recent version of OS X, Mavericks. If you go to System Preferences, and from there to Sharing, you won't find web sharing listed anywhere. It's been completely removed from the user interface.

As I said, Apache is still there, but you have to turn it on and off from the command line. And I'll show you how to do that here. I'll close the System Preferences application, and I'll go to Terminal. Terminal is your command line access to your Mac. To start Apache, use this command. Start off with sudo, that stands for super user do. Then type in the name of the Apache control application, apachectl and after a space, start. That's saying, start the Apache server.

Because you're executing the command as a super user, you're challenged for your administrative password. I'll type in the password. Press return, and that should start up the server. To test it, I'll go to a browser, and I'll type in local host. And I should get back the response, it works! A very simple HTML page, that's already in the document root of your Apache server. Now, if you don't see this right away, be patient.

On many initial installations of Mountain Lion, it takes a long time to resolve the DNS name local host. It equates to if you're using IPv4, and to another string if you're using IPv6. But this introduction of IPv6 in Mountain Lion has caused an issue with how long it might take to resolve the URL in your browser. You can wait a minute or two, and it will almost certainly work.

But that's frustrating when you're doing development. So, I'll show you a work around if you're experiencing this slowness. You can simply disable IPv6 on your computer. And as long as you don't need this new feature for the rest of your work, you'll be able to get to local host instantly right after starting up the server. To do this, I'll go back to Terminal. I'll start by using a command called network setup. I'll type networksetup, and then -listallnetworkservices.

Make sure you spell this exactly as you see it here. All lower case and all one word. That should give you a list of the services on your computer. Your list might be different from mine. You're looking for a service named Ethernet. And if you see it there, as you should, that's the thing that's slowing you down. Here's how you turn off IPv6. Just as you did when you were starting up Apache, start with sudo. Then once again, type networksetup, and then setv6off, and after another space, the name of the service, Ethernet.

You're saying, disable IPv6 completely. Don't make it a part of my operating system. I'll press Return and I shouldn't get back any response, but I also shouldn't get back any errors. I'm going to restart Apache. I'll type in clear to clear the screen. Then I'll once again use sudo apachectl, then stop. Then I'll press the up arrow, and I'll press it a few times till I get back to my start command, and I'll press Return again. I can then go back to the browser and refresh with Cmd+R.

Regardless of whether you were seeing the slow down before, you should now see the default page instantly. The location of your document root folder is exactly the same as it was in previous versions of OS X. To get to it, go to Finder, then go to the menu, and choose Go > Go to Folder. From there, type in /Library/WebServer/Documents, and it is case sensitive. That should take you to the folder that contains your HTML page, and any other assets.

And if you're creating your own website or your own PHP based web application, this is where you would put your files. These are the steps you follow to configure the Apache server when you only need a single web server for your entire machine. But when you're doing development, you'll frequently want to use a personal site folder. And I'll show you how to configure that in the next video.

Show transcript

This video is part of

Image for Installing Apache, MySQL, and PHP
Installing Apache, MySQL, and PHP

39 video lessons · 43026 viewers

David Gassner

Expand all | Collapse all
  1. 17m 35s
    1. Welcome
      1m 9s
    2. Understanding Apache, MySQL, and PHP
      7m 12s
    3. Using the exercise files
      1m 7s
    4. What's new in this update
      3m 35s
    5. Choosing a software stack
      4m 32s
  2. 30m 18s
    1. Installing Apache HTTP Server 2.4 on Windows
      6m 51s
    2. Installing PHP 5.5 on Windows
      4m 12s
    3. Starting Apache from the command line
      5m 24s
    4. Installing MySQL on Windows
      7m 24s
    5. Installing phpMyAdmin on Windows
      6m 27s
  3. 44m 5s
    1. Activating Apache on Leopard and Snow Leopard
      3m 35s
    2. Activating Apache on Lion
      5m 9s
    3. Activating Apache on Mountain Lion and Mavericks
      4m 57s
    4. Configuring personal site folders on Mountain Lion and Mavericks
      6m 59s
    5. Activating PHP on Mac OS X
      6m 12s
    6. Installing MySQL on Mac OS X
      3m 59s
    7. Setting the root user password
      2m 28s
    8. Installing phpMyAdmin on Mac OS X
      6m 16s
    9. Uninstalling MySQL on Mac OS X
      4m 30s
  4. 14m 35s
    1. Installing WampServer
      6m 25s
    2. Managing WampServer
      2m 2s
    3. Defining directory aliases through WampServer
      2m 55s
    4. Changing software versions with WampServer add-ons
      3m 13s
  5. 10m 58s
    1. Installing MAMP
      4m 6s
    2. Configuring Apache and MySQL server ports
      1m 57s
    3. Managing MAMP
      4m 55s
  6. 29m 3s
    1. Installing XAMPP for Windows
      10m 0s
    2. Managing XAMPP for Windows
      4m 4s
    3. Managing MySQL security through XAMPP for Windows
      2m 40s
    4. Installing XAMPP for Mac OS X
      6m 14s
    5. Managing XAMPP for Mac OS X
      2m 27s
    6. Managing MySQL security through XAMPP
      3m 38s
  7. 13m 20s
    1. Installing BitNami for Windows
      6m 31s
    2. Installing BitNami for Mac OS X
      6m 49s
  8. 18m 49s
    1. Handling port conflicts with Skype on Windows
      2m 37s
    2. Handling other port conflicts on Windows
      5m 19s
    3. Detecting and handling port conflicts on Mac OS X
      6m 26s
    4. Configuring Apache to work with IPv6 on Windows 8
      4m 27s
  9. 31s
    1. Goodbye

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes changes my life forever. @JosefShutter
@lynda is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold

Are you sure you want to delete this note?


Thanks for signing up.

We’ll send you a confirmation email shortly.

Sign up and receive emails about and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from

Sign up and receive emails about and our online training library:

Here’s our privacy policy with more details about how we handle your information.

submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.