How to Install Flask on Mac and Create a Web App

This article is a super quick tutorial where I will show you how to install flask on mac and create a flask hello world web application.

Card image cap

This article is a super quick tutorial where I will show you how to install Flask on mac and create a flask hello world web application. You can install Flask in about five lines of code, only following the instructions below.

What’s the difference between a program and a web application?

Usually, programs will take some inputs, then perform some tasks and returns an output. In case you heard about web applications or web services, you might be wondering what’s different between an application(or program) and a web application. A web service is a program that is available over the internet.

This type of program listen for HTTP or HTTPS requests, which are requests arriving from the internet that follow a specific format. The web service will receive the request and create a response. For instance, the response could be a web page. The server will then send the response back to the client’s web browser over the internet.

What is Flask?

You can create your web service using Flask Python. Flask is a web framework, a library that provides you with code that listens for internet requests and responds to those requests. Flask is a lightweight library. That means the framework contains minimal functionality to make the application available over the internet and allow it to communicate using web protocols like HTTP or HTTPS.

Now that you know what flask is, it is time to create our hello world.

Create a web service with Flask Python

  • Python 3 is installed on your computer.
  • Pip is also installed on your laptop. Pip is the package manager in Python, which takes care of installing any library you require for your Python programs. You will need it to install the Flask library.

How to Install flask on mac

Installing Flask through pip is quite simple. All you need to do is running this command:

pip install flask

Please note this same command will also work on windows.

Create a Flask web application

We will create a web application that will listen to internet requests and responds with the message Hello World. In other words, you will be able to send a request from the browser, and you will get a response, “Hello World.” The best part is only you only need to create one file to do this 🙂

# File name: 
from flask import Flask # include the flask library 

app = Flask(__name__) 

def index(): 
   return "Hello, World!" 

if __name__ == '__main__':, debug=True) # application will start listening for web request on port 5000

That’s all you need to do. If everything went well, you can open your browser and send a web request to your web service by entering the following URL in the address bar, and you should see the “Hello World” message.


To summarise, we have seen how to install flask on mac.

I hope you enjoyed this article, and you are now thinking about your next web application.

If you like the article, please subscribe to get notified when I publish more programming articles and how to improve your programming skills.

More Interesting Articles

Learn Ethical Hacking From Scratch Course

Become an ethical hacker that can hack computer systems like black hat hackers and secure them like security experts.

Project-Based Programming Introduction

Steady pace book with lots of worked examples. Starting with the basics, and moving to projects, data visualisation, and web applications

100% Recommended book for Java Beginners

Unique lay-out and teaching programming style helping new concepts stick in your memory

90 Specific Ways to Write Better Python

Great guide for those who want to improve their skills when writing python code. Easy to understand. Many practical examples

Grow Your Java skills as a developer

Perfect Boook for anyone who has an alright knowledge of Java and wants to take it to the next level.

Write Code as a Professional Developer

Excellent read for anyone who already know how to program and want to learn Best Practices

Every Developer should read this

Perfect book for anyone transitioning into the mid/mid-senior developer level

Great preparation for interviews

Great book and probably the best way to practice for interview. Some really good information on how to perform an interview. Code Example in Java