Since writing this article, I have updated it with new information. You can find the updated version here
In this quick tutorial, I am going to show you the easiest way to install PHP Composer on Apple mac OSX in four easy steps.
What is PHP Composer?
Composer is a dependency manager for PHP language, similar to NPM (Node Package Manager) for JavaScript programming language.
Step 1. Download
Head over to the Composer download page and scroll down to the Manual download section. Click the link to download the latest stable version.
Step 2. Move The Downloaded File
A file named composer.phar will be downloaded and saved to your computer (usually in the Downloads folder). Move it to the bin directory. Type the following command in your Terminal.
mv Downloads/composer.phar /usr/local/bin/
Step 3. Edit Bash Profile
Type ls -la
to see if the .bash_profile file already exists. If it doesn't exist, create one. To create, type touch .bash_profile
and hit the return/enter key. Edit the .bash_profile file in your terminal, type nano .bash_profile
, and hit the return/enter key. Enter the following line alias composer="php /usr/local/bin/composer.phar"
and press control + x and then, Y key, hit the return/enter key to save. Run
source .bash_profile
after.
Step 4. Check
Well done! You have PHP Composer successfully installed on your Apple machine. Type composer --version
to verify.
I hope I was helpful. Thanks.🙏
Top comments (3)
Hey, did you try homebrew?
Homebrew, of course, the main reason I wrote this post is for anyone who may encounter SSL certificate issues.
Thanks for the content