Install Composer Macos Catalina
- Install Composer Macos Catalina Free
- Install Composer Macos Catalina Update
- Install Composer Macos Catalina Os
In this blog I will be taking you step by step in installing Drush and Composer on Mac / MAMP. Right from the start, during the development on a local machine (an AMP-stack, Apache, MySQL, PHP) Drush comes in handy. For this case, we are using MAMP 4 on Mac OS Sierra. Environment setup. Open your terminal and navigate to your home directory. Installing Composer Tools Pro. Composer Tools Pro Pro Tools Setup. Extra Instructions for macOS Catalina. MacOS Catalina’s security settings require additional.
Learning and understanding Laravel, the PHP framework for web artisans can greatly improve your PHP development experience and actually make it fun, but just concentrating on the things that matter most.
Laravel takes care of all the boring lower value cruft work a developer has to go through just to get a typical site up and running.
It really is an awesome framework, however, for a new developer to get it installed can be somewhat intimidating and there are so many tools and components that come along with it, that things can get a little confusing.
Although the documentation on Laravel is quite extensive and can really help to get you working with the framework, Ironically we have found that the documentation to get it all installed and working can be a little confusing and in some areas lacking.
In this post, we hope to address some of these issues help you get up and running with Laravel on Mac OSX .
Table of contents
- How to Install PHP 7.2 on Mac OSX
- How to install Composer on Mac OSX
- How to Install Laravel on Mac OSX
- How to Add Laravel to Path on Mac OSX
- What is PATH?
- How to Edit your laravel PATH on Mac OSX
- Approach 1
- Approach 2
- Example of using Laravel new
- Install Laravel Homestead
- Configure Homestead Per Project
- Summary
How to Install PHP 7.2 on Mac OSX
The best way to set up a development environment or even to manage the packages installed on Mac OSX is to Homebrew
A word of caution though HomeBrew
If you have Homebrew installed, installing PHP is very simple, in the example below we will be installing PHP 7.2, which at the time of writing is the most current version.
PHP 7.2 is now the default in HomeBrew
If you want to have the ability to step through and debug your PHP applications you will need to install xdebug
which you will have to do using PECL
. PECL is a repository of PHP extensions which provides all known extensions and hosting facilities for downloading and development of PHP extensions.
Full Instructions to configure PHP 7 & Xdebug on Mac OSX
How to install Composer on Mac OSX
In order to install and easily use the Laravel framework, we will need to install composer
If you would like to install composer without making use of Homebrew you can so by
if you are not using HomeBrew you can install composer using Curl
Once the install has completed you can test it out by simply executing composer
How to Install Laravel on Mac OSX
We can now install Laravel using composer we will add it to the global composer
We can also generate new Laravel web applications using
How to Add Laravel to Path on Mac OSX
The Laravel Documentation refers to an alternate method of creating a new Laravel project by using,laravel new
but it requires an additional configuration step to make it work.
Make sure to place composer’s system-wide vendor bin directory in your $PATH
so the Laravel executable can be located by your system.
In my opinion, this does not clearly explain what this means or provides sufficient detail on how to do this.
What is PATH?
*nix Operating Systems and Microsoft Windows use Environment variables hold values related to the current environment. PATH
is an environment variable which is used for specifying a set of directories where executable programs are located.
In general, each executing process or user session has its own PATH setting.
How to Edit your laravel PATH on Mac OSX
There are 2 approaches you can take to edit your PATH
on MAC OSX
Approach 1
Using your terminal window, open $HOME/.bash_profile
, using any Text editor of your choice. Typically using either nano or Vim.
In this example, I will use nano
You can just copy and paste the following commands towards the end of the file –
After completing, CTRL + X
to exit and save the file.
You will then also need to refresh your current terminal window with updated bash_profile.
Approach 2
If you want to edit bash_profile
all in one line you can do so by :
You will then also need to refresh your current terminal window with updated bash_profile.
Once you have completed either of the steps above you can now create new projects using commandslaravel new [project name]
.
Example of using Laravel new
Install Composer Macos Catalina Free
We can create a new project named notepad using laravel new notepad
.
Change into the new notepad directory cd notepad
and start the project php artisan serve
Install Laravel Homestead
Laravel Homestead is a pre-packaged Vagrant box that provides a development environment without you having to install everything on your local machine. Enabling you to create a complete environment for your Laravel application.
In order to install this, you will need two additional components
- Virtual Box –
brew install caskroom/cask/virtualbox
- Vagrant –
brew install caskroom/cask/vagrant
After you have completed the installation of the above you can install Laravel Homestead by running the following:
It will take some time for the installation to complete, usually anywhere between 5 – 15 minutes depending on your connection and MacBook processing power.
Once complete you will have the latest copy of a complete Ubuntu Lamp stack server set up, which you can directly SSH into. The project files on your local machine will be synced with the VM.
Once the installation of Homestead completes, you will need to create a homestead.yaml
file that will hold all the configuration for your VM.
Configure Homestead Per Project
Homestead is configured using a YAML
file, which contains configuration information regarding sites & files on your computer, databases to create etc. When you start a new project, you have to add an entry to this file and re-provision.
Install Composer Macos Catalina Update
When using Homestead on a per-project basis, you keep this file with your project and it contains only that project’s settings. Enabling you to quickly clone a project if it’s under source control, and quickly boot a Homestead instance for that project.
This is especially helpful when setting an existing project up on a new computer, as you don’t need to manually set up Homestead and configure it for your project.
To create a Homestead.yaml
for your project.
First, we need to add development Laravel/Homestead
dependency to our project.
To do this cd
into your project directory then execute:
Once complete we can now use this package to initialize files Homestead will require and create the Homestead.yaml
If you check your directory now you will notice a file, Homestead.yaml
created.
We are now almost ready to run our project, all we need to do now is add an entry to our Host file for the website.
Then we add an entry for our new website and save the file192.168.10.10 sourcelink.test
We can now just execute vagrant up
and browse to the test site http://sourcelink.test
Summary
You should now have the complete Laravel and homestead environment setup on Mac OSX. Go ahead and enjoy your new development environment and go create the next big thing.
- How my journey into Crypto world started. - July 26, 2021
- What is CQRS? - July 25, 2021
- Book Review: Implementing Domain Driven Design - July 25, 2021
Installing Drush on MacOSX with Composer
In order to install Drush, you should first install Composer. Composer is often required for Drupal 8 and once Composer is installed, installing Drush is easy.
1. Open the Terminal app on your Mac.
2. Install Homebrew via the instructions here: https://brew.sh/
3. Install Composer globally on your Mac with this command:
brew install composer
4. If your computer doesn’t have a “/usr/local/bin” directory, create that first with this command:
sudo mkdir -p /usr/local/bin
…that creates the directory; you should be prompted to enter your computer’s password.
Now, when you type composer --version
and press Enter, we’ll see that you have Composer installed!
5. Install Drush via Composer:
Note!: Please do not install Drush using composer global require
. See Pantheon’s article, Fixing the Composer Global command.
Install Composer Macos Catalina Os
Instead, first install the Composer global require
command:
composer global require consolidation/cgr
6. Add the vendor/bin
from the Composer home directory to your $PATH.
(Thereafter, you may substitute cgr
for any command line tool whose installation instructions recommends the use of Composer global require. Example: cgr drush/drush
)
If you get a popup to install the Xcode Developer tools, go ahead and install Xcode.
7. Update the system $PATH:
vim ~/.bash_profile
to edit the file press the i
key to enter Insert mode
…next, copy and paste this into that file:
export PATH='$HOME/.composer/vendor/bin:$PATH'
PATH='$(composer config -g home)/vendor/bin:$PATH'
Press the Escape (esc) key to switch back to command mode.
Type :wq
and press Enter to save and quit the file.
8. Quit the Terminal app (or, run the “source” command to load the .bash_profile file without having to restart the Terminal.)
To run the source command:
source ~/.bash_profile
9. Now you will actually install Drush:
Install latest stable Drush:
cgr drush/drush
Now if you type drush
and press Enter, you’ll see that Drush is installed, and working on your machine!