as of Jan 2025, Option (1) still is my preferred way of running http server on my macbook!
Python comes pre-installed on macOS and provides a simple way to start a local server:
- For Python 3:
python3 -m http.server 8000- For Python 2 (older versions):
python -m SimpleHTTPServer 8000After running either command, you can access your server at http://localhost:8000
If you have Node.js installed:
- Install the
http-serverpackage:
npm install -g http-server- Run the server:
http-serverIf you have PHP installed, you can use its built-in server:
php -S localhost:8080This will start a server accessible at http://localhost:8080
macOS comes with Apache pre-installed:
- Start Apache:
sudo apachectl start- Access the server at
http://localhost
You can edit the default page in /Library/WebServer/Documents/
MAMP is a free, user-friendly application that sets up a local server environment:
- Download and install MAMP
- Start the MAMP application
- Access your server at
localhost:8888
You can install and run Apache using Homebrew:
- Install Apache:
brew install httpd- Start the service:
brew services start httpd- Access the server at
http://localhost:8080