January 2, 2024 · 5 min read
Building a modern application with Laravel requires setting up your development environment with various tools. For MacOS users, Homebrew is a popular package manager that simplifies installations, while Windows users often prefer Laragon for a hassle-free setup. Here's a step-by-step guide to installing PHP, Composer, Node.js, NPM, and setting up a database using SQLite or MySQL.
Open the Terminal and run the following command to install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Use Homebrew command to install PHP:
brew install php
Composer is a PHP dependency manager. Install it with Homebrew using
brew install composer
Node.js comes with NPM, and you can install both using Homebrew:
brew install node
Install Valet with Composer and you will be able to access your site with
blog.test. First run:
composer global require laravel/valet
Then run the following:
With Valet, you use the
park command in a directory to serve all projects within as individual sites. We usually save our projects in a Sites directory on our Desktop, feel free to do the same. Navigate to your projects directory, for example
cd Sites , then run:
Now, any Laravel project within this directory can be accessed via the
<project-name>.test URL. For example, if your Laravel blog directory is named
blog, you can access it at
Download the Laragon full version from the official website and follow the installation instructions. Open Laragon and start its services. Laragon includes PHP, MySQL, and Apache out of the box.
Laragon makes it easy to install Composer. Open Laragon and click on "Menu" > "Tools" > "Quick add" and select "Composer" from the list. Click on "Menu" > "Tools" > "Quick add" and select "Node.js" from the list.
Once you have PHP, Composer, Node.js, and NPM installed, you can install Laravel using Composer:
composer create-project laravel/laravel blog
This command will create a new Laravel project in a directory called
You could also install the Laravel installer and then it's even easier to start your app.
composer global require laravel/installer
Then you simply run the following command to install a fresh Laravel app:
laravel new blog
We will show you how to set up SQLite or MySQL in this guide. It's up to you to decide which one. Just a heads-up, with Laravel 11, SQLite is the go-to database by default.
We need to comment out (put a # sign in front of them) the rest of the database configuration when using SQLite because we don't need them. We can simply run the following command and it will ask if we want to create the database. Choose yes and it will do it for you.
php artisan migrate
We strongly suggest that you install DBngin for MySQL on your MacOS system, but you can also manually install it via Homebrew if you prefer streetfighting.
Laragon includes MySQL. You can access the database via Laragon's "Database" menu, which opens up phpMyAdmin, where you can manage your databases. Add a new database named
Update your Laravel
.env file to use the MySQL
blog database created in DBngin (MacOS) or Laragon (Windows).
Now simply run the migration script and you have your database ready:
php artisan migrate
If you're using Laravel Valet and you've parked your directory, you can simply visit
http://blog.test in your browser. Or, if you're a Windows user and using Laragon, the same applies.
If you're not using Valet or Laragon, you can use the built-in PHP server to serve your Laravel application locally:
php artisan serve
This will start a development server at
With these steps, you've set up your development environment on MacOS using Homebrew or on Windows using Laragon. You have PHP, Composer, Node.js, NPM, and a database ready to go for your Laravel application project. Laravel's simplicity and elegance, combined with these tools, make for a powerful development experience, whether you're a beginner or an experienced developer.
If you need help with a Laravel project let's get in touch.
Lucky Media is proud to be recognized as a Top Laravel Development Agency
Cofounder and CFO of Lucky Media
Stay up to date
Be updated with all news, products and tips we share!