How to Start a Simple Web Server in Python 3 on Mac

If you’re a Python user on a Mac, you might already know that you can create a simple web server using a script. However, if you’ve recently upgraded to Python 3, the traditional script won’t work. But don’t worry, you can still start a web server using Python 3 on your Mac with a slightly different command. In this guide, we’ll show you how to start a simple web server in Python 3 on Mac.

Starting a Web Server in Python 3.0+

If you already have Python 3.0+ installed or upgraded on your Mac, you can start a web server using the following command:

python -m http.server


python3 -m http.server

Simply enter the command in the terminal and hit enter. The web server will start immediately, serving files from the directory where the command was executed. You can access the server by opening the URL in any browser on your computer.

Python3 Equivalent of python -m for CGIHTTPServer

If you need to run a Python Common Gateway Interface (CGI) server for CGI scripts in Python or Perl, you can use the following command:

python3 -m http.server --cgi


python -m http.server --cgi

Make sure to include the –cgi flag to start the CGI HTTP server in Python 3.

Error: “/usr/bin/python: No module named http”

If you encounter this error when running the python -m http.server script, it means you’re either not using Python 3 or using the wrong command for python3. Make sure you’re using the correct version and command, depending on how it was installed or upgraded on your Mac. If you’re using an older version of Python, you can try using the command python -m SimpleHTTPServer for Python 2 and earlier.

While Python simple web servers are great for testing and development purposes, they are not intended for production environments. For a more stable and secure web server, consider using Apache or Nginx. Alternatively, you can use MAMP to easily set up a complete Apache, MySQL, and PHP environment on your Mac.


1. What devices and operating systems are supported?

This guide is specifically for Apple devices running macOS or iOS.

2. How does this guide help me?

This guide provides step-by-step instructions on how to start a simple web server in Python 3 on a Mac, helping you leverage Python for web development and testing.

Benefits of How to Start a Simple Web Server in Python 3 on Mac

  • This guide is free to read and provides valuable information on starting a web server in Python 3 on a Mac.
  • It helps Python users on Mac follow a simple process to set up a web server for testing and development purposes.

If you have any further questions or need more assistance, feel free to ask in the comments or contact us directly through our contact page.

Editorial Staff
Editorial Staff
The Bollyinside editorial staff is made up of tech experts with more than 10 years of experience Led by Sumit Chauhan. We started in 2014 and now Bollyinside is a leading tech resource, offering everything from product reviews and tech guides to marketing tips. Think of us as your go-to tech encyclopedia!


Please enter your comment!
Please enter your name here

Related Articles

Best Telemedicine Software: for your healthcare practice

Telemedicine software has transformed my healthcare visits. It's fantastic for patients and doctors since they can obtain aid quickly. I...
Read more
I love microlearning Platforms in today's fast-paced world. Short, focused teachings that engage me are key. Microlearning platforms are great...
Think of a notebook on your computer or tablet that can be changed to fit whatever you want to write...
As of late, Homeschool Apps has gained a lot of popularity, which means that an increasing number of...
From what I've seen, HelpDesk software is essential for modern businesses to run easily. It's especially useful for improving customer...
For all of our important pictures, stories, and drawings, Google Drive is like a big toy box. But sometimes the...