How to Install Laravel 11 on macOS?
Laravel, a popular PHP web framework, is known for its expressive syntax and robust ecosystem. Follow these detailed steps to install Laravel 11 on macOS.
Step 1: Install Homebrew
Homebrew is a package manager for macOS that simplifies the installation of software.
Open Terminal.
Run the following command:
- Follow the on screen instructions to complete the installation.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Step 2: Install Node.js and npm
Node.js and npm are required for Laravel’s frontend dependencies.
- In Terminal, run:
brew install node
Step 3: Install PHP
Install PHP using Homebrew.
- In Terminal, run:
brew install php
Step 4: Install Composer
Composer is a dependency management tool for PHP, essential for installing Laravel.
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Step 5: Verify PHP and Composer Installations
Ensure PHP and Composer are installed correctly.
php --version
composer --version
You should see the versions of PHP and Composer displayed.
Step 6: Install Laravel Using Composer
Install Laravel globally on your system using Composer.
composer global require laravel/installer
Step 7: Verify Laravel Installation
Ensure Laravel is installed correctly.
You can see the Laravel version displayed.
laravel --version
Step 8: Create a New Project
Create a new Laravel project.
composer create-project --prefer-dist laravel/laravel app-name
Replace app-name
with your desired project name.
Navigate to the new project directory:
cd app-name
Replace app-name
with the actual name you used for your project.
Step 9: Run the Laravel Server
Start the local development server.
php artisan serve
Open your web browser and go to :
http://127.0.0.1:8000
Conclusion :
By following these steps, you’ll have Laravel 11 installed and ready to use on your macOS system. Laravel’s powerful framework provides a solid foundation for building modern web applications.