How to Set Up a Laravel 11 on MacOS

Setting up a Laravel development environment on a Mac is a straightforward process. Laravel is a popular PHP framework known for its elegant syntax and powerful features. To get started, follow these steps:

  1. Install Homebrew:
    Homebrew is a package manager for macOS. Open Terminal and run the following command to install Homebrew:
   /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  1. Install PHP:
    Laravel requires PHP. Install PHP using Homebrew by running the following command:
   brew install php
  1. Install Composer:
    Composer is a dependency manager for PHP. Run the following command to install Composer:
   brew install composer
  1. Install Laravel Installer:
    Laravel provides a command-line tool called Laravel Installer. Install it globally using Composer:
   composer global require laravel/installer
  1. Set Up Composer Global Path:
    Make sure Composer global binaries are available in your system’s PATH. Run the following command:
   echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bash_profile
   source ~/.bash_profile
  1. Create a New Laravel Project:
    Navigate to the directory where you want to create your Laravel project and run the following command:
   laravel new project-name
  1. Start Laravel Development Server:
    Navigate to your project directory and start the Laravel development server by running:
   php artisan serve
  1. Access Your Laravel Application:
    Open your web browser and go to http://localhost:8000. You should see the Laravel welcome page, indicating that your development environment is set up correctly.

Congratulations! You have successfully set up a Laravel development environment on your Mac. You can now start building amazing web applications using Laravel.

Leave a Reply