Yes, starting Web Sharing in OS X Mountain Lion is easy, but Apple removed the checkbox from the Sharing preferences pane, so you have to turn it on with a single Terminal command or by using a third-party utility. Once enabled, your Mac serves websites from its built-in Apache web server, and you can access them from other devices on your local network immediately.
Why Apple Hid Web Sharing in Mountain Lion
Before OS X Mountain Lion (10.8), Web Sharing was a visible option in System Preferences > Sharing. You could check a box to start Apache, and your Sites folder was served at http://localhost/~username. In Mountain Lion, Apple removed that checkbox. The underlying Apache server is still there, but Apple chose to de-emphasize it for a few reasons:
- Most home users never used Web Sharing, so it was clutter in the Sharing pane.
- Apple shifted focus to iCloud and simpler file-sharing methods like AirDrop.
- Running a web server on a consumer Mac can be a security risk if the user doesn’t understand firewalls and port forwarding.
The good news is that the Apache binaries, configuration files, and the Sites folder are all still present. You just need to activate them manually.
How to Start Web Sharing with Terminal
The most direct way is to use the apachectl command in Terminal, which is the standard Apache control tool. Here are the exact steps:
- Open Terminal (in Applications > Utilities).
- Type
sudo apachectl startand press Enter. - Enter your administrator password when prompted. You won’t see characters as you type, which is normal.
- To confirm it’s running, open Safari and go to
http://localhost. You should see a page that says “It works!” (the default Apache test page).
If you want the server to start automatically every time your Mac boots, use sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist instead. To stop the server later, use sudo apachectl stop.
Using Your Sites Folder
By default, Apache in Mountain Lion serves the folder /Library/WebServer/Documents as the web root. That means any file you put there is accessible at http://localhost/filename. However, the classic personal web sharing feature used ~/Sites (your home folder’s Sites directory). To use that, you need to enable the user module and create the folder:
- Create a folder named
Sitesin your home directory if it doesn’t already exist. - Edit the Apache configuration file:
sudo nano /etc/apache2/httpd.conf - Find the line
#LoadModule userdir_module libexec/apache2/mod_userdir.soand remove the#at the beginning to uncomment it. - Find the section that starts with
<IfModule mod_userdir.c>and make sure it has a line likeUserDir Sites(it usually does). - Save the file (Ctrl+O, then Enter, then Ctrl+X to exit nano).
- Restart Apache with
sudo apachectl restart.
Now your personal sites are available at http://localhost/~your_username (replace your_username with your actual Mac username).
Accessing Your Mac from Other Devices
Once the server is running, you can access it from other computers, phones, or tablets on the same Wi-Fi network. You need your Mac’s IP address. To find it:
- Go to System Preferences > Network.
- Select your active connection (Wi-Fi or Ethernet).
- Your IP address is shown on the right, something like
192.168.1.5.
From another device, type http://192.168.1.5 in the browser (or http://192.168.1.5/~username for your personal folder). If that doesn’t work, check the firewall:
- Go to System Preferences > Security & Privacy > Firewall.
- If the firewall is on, click the lock to make changes, then click Firewall Options.
- Make sure “Block all incoming connections” is unchecked, and that Apache or “Web Server” is allowed to accept incoming connections.
Common Problems and Fixes
Even with the correct commands, things can go wrong. Here are the most frequent issues and how to solve them:
- “It works!” page doesn’t load – Apache may not have started. Run
sudo apachectl startagain and check for error messages. Also verify port 80 isn’t blocked by another app (like Skype or a previous web server). - Permission errors (403 Forbidden) – This usually means your
Sitesfolder or its contents have wrong permissions. In Finder, get info on the folder, set permissions to “Read & Write” for your user, and make sure the folder is not named with spaces or special characters. - PHP not working – Mountain Lion ships with PHP 5.3, but it’s disabled by default. In
/etc/apache2/httpd.conf, uncomment the line#LoadModule php5_module libexec/apache2/libphp5.so, then restart Apache. - Can’t access from another device – Double-check the IP address, ensure both devices are on the same network, and temporarily disable the firewall to test. If it works with the firewall off, add an exception for Apache.
- Server won’t start after editing httpd.conf – A syntax error in the config file will prevent Apache from starting. Run
sudo apachectl configtestto find the exact line with the error.
Alternatives to Terminal
If you’re not comfortable with the command line, there are free utilities that add the Web Sharing checkbox back to System Preferences. These apps essentially do the same thing as the Terminal commands, but with a graphical interface. A few options existed for Mountain Lion:
- Web Sharing Tool – A small app that toggles the launch daemon and shows the status.
- SharePoints – A more advanced tool that also lets you create aliases and set permissions.
- MAMP – Not just for Web Sharing, but a full Apache/MySQL/PHP stack that runs independently of the system Apache. It’s a good choice if you need a database too.
These tools can be convenient, but they often rely on the same underlying mechanisms, so if something breaks, you’ll still need to use Terminal to debug.
Security Considerations
Running a web server on your Mac exposes it to the network. Here’s what you need to know:
- Local network only – If you don’t set up port forwarding on your router, only devices on your Wi-Fi can see the server. That’s usually fine for testing or sharing files with family.
- Port forwarding – To make your site public on the internet, you’d need to forward port 80 on your router to your Mac’s IP. This is risky if you don’t know how to secure Apache. Avoid doing this for a personal Mac unless you have experience.
- Keep your Mac updated – Apple stopped supporting Mountain Lion in 2015, so there are no security patches. Running a public server on an unsupported OS is a serious vulnerability. If you need to host publicly, use a modern OS or a dedicated hosting service.
- Disable directory listing – By default, Apache may show a list of files if there’s no index.html. You can disable this in
httpd.confby changingOptions IndexestoOptions -Indexes.
Frequently Asked Questions
Does Web Sharing work the same as in Lion or Snow Leopard?
Yes, functionally it’s the same Apache server. The only difference is that the checkbox is hidden in Mountain Lion, so you need to use Terminal or a third-party tool to start it. Once running, the behavior is identical.
Can I use Web Sharing to host a WordPress site?
Yes, but you’ll also need to enable PHP (as described above) and install MySQL separately. Mountain Lion doesn’t include MySQL, so you’d need to download it or use a package like MAMP. WordPress will run, but this setup is better for local development than for a live site.
Why do I get a 403 Forbidden error when I access my Sites folder?
This is almost always a permissions issue. Your Sites folder must be readable by the web server. In Finder, right-click the folder, choose Get Info, and set permissions to “Read & Write” for your user. Also, make sure the folder doesn’t have a period at the beginning of its name (like .Sites), as Apache ignores hidden folders.
How do I stop Web Sharing after I’ve started it?
Use sudo apachectl stop in Terminal. If you loaded the launch daemon with launchctl load, you can unload it with sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist to prevent it from starting at boot.
Is it safe to leave Web Sharing on all the time?
On a local network, it’s generally safe as long as your firewall is enabled and you don’t forward ports. However, because Mountain Lion is no longer supported, any security vulnerabilities in Apache or the OS won’t be patched. It’s best to turn it off when you’re not using it, and never expose it to the internet.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Stop Partitioning SSDs Unless You Dual Boot
- OnePlus Exiting US and Europe? Facts
- Shows With Unskippable Opening Titles?
- Switch 2 Paid Tutorial: Real Discoveries
- Better Phone Link Clipboard Sync Alternative?
- What Network Does Mint Mobile Use?