Magento 2 needs Composer, so let install it on OS X in a way it can be used globally.
Considering that installing Composer will create a
composer.phar file, and our intention is to use it everywhere, anytime, regardless the project we're working on, I decided to install it (meaning let the composer.phar be created) in
/Applications/Composer (it makes sense to me, but you can choose the destination folder you want).
First thing first, let's go to
/Applications, create the
Composer folder, and get in.
cd /Applications/ mkdir Composer cd Composer
Now, we can install Composer for real using cURL.
curl -sS https://getcomposer.org/installer | php
If everything goes as expected we'll get a nice message saying something like "Composer successfully installed to..." and we can proceed to the next step.
Making it globally available
Now that we have the
composer.phar file, we need (or want?) to have it globally available by typing
composer in the command line. To achieve this let's start by moving our
composer.phar file to
sudo mv composer.phar /usr/bin/
And finally let's create an alias on our bash profile.
alias composer="php /usr/bin/composer.phar"
Reload the command line profile, and that's all it takes to get Composer on OS X. You can now go to any folder you want and type
composer about. If something nice appears it means everything is okay.
I might be skipping the part where I'm supposed to explain how to edit and reload the bash profile. It was on purpose because it always different depending on the terminal you use (for example mines it's located in
~/.zshrc because I use Oh My ZSH!).
You can try the following in order to access and edit the bash profile.