Home >PHP Framework >Laravel >Install laravel on mac
Laravel is an excellent PHP framework that is widely used in web development. Installing Laravel on Mac requires some basic command line tools, as well as support from software such as PHP and Composer. This article will guide you step by step to install Laravel on Mac.
First, we need to install a Mac package manager-Homebrew, which allows us to install and manage various applications more conveniently.
Execute the following command in the terminal to install Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
After the installation is completed, we can use the brew
command to install various software packages, such as PHP, Composer, etc.
Laravel runs based on PHP, so we need to install PHP and Composer on Mac. Execute the following command in the terminal to install:
brew install php
brew install composer
After the installation is completed, we can use the php -v
and composer -v
commands to verify whether the installation is successful.
Before installing Laravel, we also need to install some extension packages and command line tools.
brew install imagemagick
brew install php-intl
composer global require laravel/installer
After the installation is complete, we can use laravel
Commands to create and manage Laravel projects.
Execute the following command to create a new Laravel project:
laravel new myproject
This will create a project named myproject
in the current directory new project. When executing this command, Laravel's core code and dependency packages will be automatically downloaded, and some default file and directory structures will be created for us.
Execute the following command to start the Laravel development server:
cd myproject
php artisan serve
By default, Laravel will run at http://localhost:8000
Start the development server.
Now we can visit http://localhost:8000
in the browser to view Laravel’s default welcome page!
The above are all the steps to install Laravel on Mac. It should be noted that you may encounter various dependencies and environmental problems during the installation process, and you need to make adjustments and adjustments according to the error prompts. solve. I hope this article can help developers who want to use Laravel on Mac.
The above is the detailed content of Install laravel on mac. For more information, please follow other related articles on the PHP Chinese website!