Wednesday, November 17, 2021

How to install Composer in MacOS

Install download the composer using the following curl command in the terminal:
curl -sS https://getcomposer.org/installer | php
 
After the command, you will have composer.phar file in the current directory and the composer command is available as: 

 php composer.phar [composer commnad] 

In order to make composer available globally, you have to move the recently downloaded composer.phar to local user’s bin folder as follow: 

sudo mv composer.phar /usr/local/bin/

 go to /usr/local/bin folder . 
You can click Shift + Command + G to open the dialog to go to folder. move the recently downloaded composer.phar in the usr/local/bin folder. 

We want to run Composer with having to be root al the time, so we need to change the permissions:
 sudo chmod 755 /usr/local/bin/composer.phar
create a alias using command:

Next, we need to let Bash know where to execute Composer:

 nano ~/.bash_profile
Add this line below to bash_profile and save
alias composer="php /usr/local/bin/composer.phar"
and then run this command:

 source ~/.bash_profile

Finally, run: composer --version

Now, you can access the composer from the terminal simply using the composer command.




No comments:

Post a Comment

Extract Domain from email in Excel or Google sheet

  =TEXTAFTER( A2 , "@") or, =MID(A1, FIND("@", A1) + 1, LEN(A1) - FIND("@", A1))