How to install composer in Mac OSX?
Composer is a tool for dependency management in PHP. We also can call it a cross-platform dependency manager for PHP. It allows us to declare the depend libraries for projects and it will manage (install/update) those libraries for the project.
Following are the steps to download and install composer from command line:
Download composer:
$ curl -sS https://getcomposer.org/installer | php
If we run the above command it will create a phar (PHP Archive) file called composer.phar.
Move composer.phar file to bin directory:
$ sudo mv composer.phar /usr/local/bin/
Change composer.phar file permission :
$ sudo chmod 755 /usr/local/bin/composer.phar
Open the .bash_profile file:
$ vi ~/.bash_profile
Make composer executable:
Paste the following line at the end of the .bash_profile file and save the file
$ alias composer="php /usr/local/bin/composer.phar"
alias composer=”php /usr/local/bin/composer.phar”
and then run this command:
source ~/.bash_profile
Check composer the version:
composer –version
~ $ composer ______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /_/ Composer version 1.9.0 2019-08-02 20:55:32 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question --profile Display timing and memory usage information --no-plugins Whether to disable plugins. -d, --working-dir=WORKING-DIR If specified, use the given directory as working directory. --no-cache Prevent use of the cache -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug