Install Laravel: Ultimate Guide for Windows, macOS, and Linux

Thanks to its robust ecosystem and clean coding practices, Laravel has established itself as one of the best PHP frameworks. Its ability to streamline complex tasks makes it a go-to choice for web development experts worldwide.

But like every web framework or software, the first step in using Laravel is installing it on your development environment. As you might expect, the installation process differs based on your preferred operating system.

This blog covers how to install Laravel on Windows, macOS, and Linux. But first, let’s talk about Laravel.

What is Laravel?

Laravel is a popular PHP framework known for its elegant syntax and powerful features that streamline the web development process. It offers a robust set of tools with a strong emphasis on simplicity and clarity. That has made Laravel an excellent platform for creating high-quality web applications.

Key Features of Laravel

  • MVC Architecture Support: Laravel enforces the Model-View-Controller (MVC) design pattern. It promotes clean code separation and organization. And this structure improves maintainability and collaboration on projects.
  • Eloquent ORM: Laravel’s built-in Object Relational Mapper (ORM), called Eloquent, simplifies database interactions. Laravel developers work with databases using an object-oriented approach, making it more intuitive and less error-prone.
  • Secure by Design: Laravel security practices include user authentication, authorization, data validation, and more. It protects the site against common web vulnerabilities like Cross-Site Scripting (XSS) and SQL injection.
  • Artisan CLI: This command-line interface tool streamlines repetitive tasks. Artisan offers functionalities for creating new projects, managing database migrations, and more.
  • Blade Templating Engine: Laravel has a built-in templating engine called Blade. It provides a lightweight and expressive way to structure application views. Blade allows for easy integration of PHP code within templates for dynamic content generation.
  • Modular Design: Laravel’s core functionalities are divided into independent modules. It allows for granular control and customization. Developers can easily swap out specific components based on project requirements.
  • Package Ecosystem: A vast collection of third-party Laravel packages extends the framework’s functionality. These packages offer pre-built functionalities like caching, social media integration, eCommerce, and more. Some common packages include Socialite, Cashier, Mix, Nova, etc.
  • Unit Testing: Laravel provides built-in support for unit testing, encouraging developers to write clean and maintainable code. This fosters a test-driven development approach, leading to more robust applications.

Moreover, Laravel offers built-in authentication and authorization (through Laravel Policies and Gates). That makes it easier to implement user authentication and access control in applications. These are just a few features that make Laravel an excellent framework.

Why Use Laravel?

Laravel is a preferred platform for web developers and there are several reasons behind it. Let’s discuss a few of them.

Elegant Syntax

Laravel provides a clean and expressive syntax, so coding in PHP is more enjoyable and efficient. It follows the principle of “convention over configuration”. So, you don’t need to write repetitive code, thanks to default configurations and structures.

Modular and Extensible

Laravel has a set of individual libraries that work together seamlessly. These libraries are modular and can be used independently outside the Laravel framework. Plus, Laravel development experts can extend its functionality with third-party packages.

MVC Architecture

Laravel follows the Model-View-Controller (MVC) architectural pattern. It promotes separation of concerns and makes the codebase more organized and maintainable. This separation allows developers to work on different aspects of the application independently. That enhances collaboration and code readability.

Built-in Features

Laravel comes with a variety of built-in features. They simplify common tasks in web development, like authentication, routing, caching, and session management. These features save developers time and effort with ready-to-use solutions out of the box.

Database Migration and ORM

Laravel’s migration system allows developers to define and manage database schemas using PHP code. That makes it easier to version-control and share database changes across different environments.

Additionally, Laravel’s Eloquent ORM provides a simple and intuitive way to interact with the database using PHP objects, reducing the need for writing complex SQL queries.

Blade Templating Engine

Laravel includes a powerful templating engine called Blade. It simplifies the process of creating and managing views. Blade templates are lightweight, fast, and intuitive. Developers can write concise and readable code for their application’s frontend.

Community Support and Ecosystem

Laravel has a large and active community of developers who contribute to its ecosystem by creating tutorials, packages, and resources. This vibrant community ensures that developers have access to a wealth of knowledge and support when working with Laravel.

Performance and Scalability

Performance can vary based on factors such as server configuration and application architecture. But Laravel is designed to be performant and scalable. It includes features like caching, queueing, and optimization tools. They make sure the application performs well and handles increased traffic with ease.

With Laravel, web developers can build modern web applications efficiently, securely, and with a focus on long-term maintainability. This makes it a favorite choice for developers across various industries and project sizes.

Looking for Laravel services for your web application?

What are the Prerequisites for Laravel Installation?

Before installing Laravel, you need to consider some basic system requirements, depending on the OS. That ensures a smooth setup and development environment.

Laravel is built on PHP. So, first and foremost, you’ll need the most recent version of PHP (typically PHP >= 8.0). And you will need Composer, one of the fundamental PHP development tools. This dependency manager simplifies the installation and management of PHP libraries and packages.

Operating System Specifics

The core dependencies remain consistent across operating systems. But there might be slight variations in how you acquire them:

For Windows

  • Recommended Approach: Windows Subsystem for Linux 2 (WSL2): WSL2 provides a robust Linux environment within Windows. It grants access to powerful package management tools like apt-get. That simplifies the installation of PHP and other dependencies.
  • Alternative Approach: Direct PHP Installation: If WSL2 isn’t your preference, consider installing PHP directly using a package manager like XAMPP or MAMP. However, this method might involve additional configuration steps.

For macOS

  • Streamlined Installation with Homebrew: Homebrew is a popular macOS package manager. It simplifies the installation of PHP and Composer, making the setup process efficient.

For Linux

  • Package Managers: The specific package manager will vary depending on your Linux distribution (like Ubuntu, Debian, CentOS). Most distributions offer built-in repositories with PHP and Composer readily available. Use your distribution’s package manager for a streamlined installation process.

Along with the ones shown above, there may be some other prerequisites to consider. Those will depend on your specific project. For that, you can consult with dedicated Laravel experts.

How to Install Laravel on Windows, macOS, and Linux?

After you have covered the prerequisites for Laravel installation, you can start the process. There may be some differences in the installation process for the different operating systems. Let’s look at them one by one.

For Windows

As mentioned in the prerequisite section, there are two ways to install Laravel for Windows.

Method 1: Leveraging Windows Subsystem for Linux 2 (WSL2)

Step 1: Enable WSL2: If not already activated, follow Microsoft’s official documentation to enable WSL2 on your Windows machine.

Step 2: Install your preferred Linux distribution: Choose a Linux distribution like Ubuntu or Debian from the Microsoft Store and install it within WSL2.

Step 3: Update package lists and install PHP & Composer: Within your WSL terminal, update package repositories using the appropriate command for your chosen distribution (e.g., sudo apt update for Ubuntu/Debian). Subsequently, install PHP and Composer using your distribution’s package manager (e.g., sudo apt install php composer for Ubuntu/Debian).

Step 4: Install Laravel using Composer: Navigate to your desired project directory using the cd command in your terminal. Then, execute the following command to install a new Laravel application:

composer global require "laravel/installer" && laravel new my-laravel-app

(Replace “my-laravel-app” with your preferred project name).

Method 2: Using XAMPP/MAMP

Step 1: Download and install XAMPP/MAMP: Download and install a solution like XAMPP or MAMP, which bundles Apache, MySQL (or MariaDB), and PHP into a single package.

Step 2: Verify PHP installation: Open your web browser and navigate to http://localhost/phpinfo.php to confirm PHP is functioning correctly.

Step 3: Install Composer: Download Composer from the official website and follow the installation instructions for Windows.

Step 4: Create a project directory: Create a directory for your Laravel project within your web server’s document root (e.g., C:\xampp\htdocs\my-laravel-app).

Step 5: Install Laravel using Composer: Navigate to your project directory in the terminal and execute the following command:

composer global require "laravel/installer" && laravel new .

The dot (.) indicates the current directory.

For macOS

Unlike Windows, the Laravel installation process on macOS is more streamlined. That is thanks to Homebrew.

Step 1: Install Homebrew: If not already installed, follow the instructions on the Homebrew website to install it.

Step 2: Update Homebrew and install PHP & Composer: Open a terminal window and run the following command to update Homebrew’s package list:

brew update

Then, install PHP and Composer using:

brew install php composer

Step 3: Install Laravel using Composer: Navigate to your desired project directory and execute the following command:

composer global require "laravel/installer" && laravel new my-laravel-app

For Linux

The installation process on Linux is similar, with slight variations depending on your distribution:

Step 1: Update package lists: Utilize the update command specific to your distribution (like sudo apt update for Ubuntu/Debian or sudo yum update for CentOS/RHEL).

Step 2: Install PHP & Composer: Install PHP and Composer using your distribution’s package manager (like sudo apt install php composer for Ubuntu/Debian or sudo yum install php composer for CentOS/RHEL).

Step 3: Install Laravel using Composer: Navigate to your desired project directory and run the following command:

composer global require "laravel/installer" && laravel new my-laravel-app

That concludes the installation of Laravel on your development environment. Now, you can start working on your project. If you need help with the installation and development process, opt for our Laravel development services.

How to Create a New Laravel Project?

First, make sure you have successfully installed Laravel with the instructions for your OS. After that, you create a new project and start the development process.

Step 1: Open your terminal or command prompt and navigate to the project directory using the command: cd

This is where your new Laravel project will reside.

Step 2: Once in the desired directory, type the following command:

laravel new myproject

Replace “myproject” with your preferred project name.

The installation process might take a few moments as it downloads necessary dependencies.

Step 3: After the command is executed successfully, you will have a new directory with the core Laravel files.

This organized structure helps you build the web application.

FAQs on Laravel Installation

What is the recommended PHP version for installing Laravel?
The recommended PHP version for installing Laravel is PHP 7.2 or above. Laravel will work with older versions of PHP, but it is recommended to use a newer version for optimal performance and security.
Do I need to install any additional software to use Laravel?
Yes, you will need to have a web server, PHP, and a database installed on your system in order to use Laravel. However, the Laravel installation itself will take care of setting up the necessary dependencies for your project.
Can I install Laravel using a GUI rather than the command line?
Yes, you can install Laravel using a GUI, but it is not the recommended method. The best way to install Laravel is through the command line using Composer, as it allows for easier management of dependencies and updates in the future.


Laravel is an excellent framework for creating dynamic websites and web apps. But to install it in your development environment, there are some prerequisites.

The core requirements (PHP and Composer) remain the same across all operating systems. However, there are slight variations in the installation methods:

  • Windows: WSL2 (Windows Subsystem for Linux 2) is the recommended approach, offering a familiar Linux environment for installing PHP and Composer. Alternatively, direct PHP installation using XAMPP/MAMP is possible.
  • macOS: Homebrew, a popular package manager, simplifies the installation of PHP and Composer on macOS.
  • Linux: Utilize your distribution’s built-in package manager (e.g., apt-get, yum) to install PHP and Composer.

For guidance and support with Laravel installation and development, our Laravel development company might be of help.

Need help with your Laravel web project?

Mayur Upadhyay is a tech professional with expertise in Shopify, WordPress, Drupal, Frameworks, jQuery, and more. With a proven track record in web development and eCommerce development.

Leave a comment