Setting Up Composer For Terminal - terminal

I was wondering on the newest version of Terminal and Os X how I could install the "Composer" code inside of Terminal because the tutorial I am following needs it.
If anyone could give me the code for Terminal to install this, that would be great.
Thanks.

you should have curl on your os x install:
curl -sS https://getcomposer.org/installer | php
Then, you have to move it into /usr/local/bin if you want to use it globally:
sudo mv composer.phar /usr/local/bin/composer
and change permissions to let normal user execute composer:
sudo chmod +x /usr/local/bin/composer

Related

Unable to install composer globally on Mac OS Catalina

I want to install composer for laravel development on my latest version of mac OS. I followed all the step by step instructions to install composer on the website and it installed composer.phar. So I have to move to /usr/local/bin/composer for it to work.
I ran the usual command:
mv composer.phar /usr/local/bin/composer
and it gave an error saying /usr/local/bin/composer: No such file or directory
I even added a sudo command in front to see if it works and received the same error. I looked up other solution telling me to make a new directory there, but it wouldn't let me do so and gave me a permission denied error.
You should create the directory manually before proceeding:
sudo mkdir -p /usr/local/bin
then
sudo mv composer.phar /usr/local/bin/composer
For solving your second problem
It needs zip extension,
Check your PHP version first
php -v
If for instance PHP version is 7.2, then try below command (use your PHP version)
brew update
brew install php#7.2
brew link php#7.2

Issues installing composer correctly on OS X El Capitan

I know there are some questions about how to install composer on SO, but they did not help me.
I am trying to install composer (for laravel). I have OS X El Capitan.
I downloaded composer like this:
$ curl -sS https://getcomposer.org/installer | php
#!/usr/bin/env php
All settings correct for using Composer
Downloading...
Composer successfully installed to: /Users/blckbird/composer.phar
Use it: php composer.par
Next, I tried to execute the laravel installation:
composer global require "laravel/installer"
Which did not work because:
-bash: composer: command not found
So I tried:
sudo mv composer.phar /usr/local/composer
Which worked, however, I still can not execute composer (same error as above).
What am I doing wrong and how can I install composer correct?
Since your composer.phar is installed in /Users/blckbird/, try this for global installation:
sudo mv /Users/blckbird/composer.phar /usr/local/bin/composer
Note: On some versions of OSX the /usr directory does not exist by default. If you receive the error "/usr/local/bin/composer: No such file or directory" then you must create the directory manually before proceeding: mkdir -p /usr/local/bin. More info.

Installing Symfony,Composer

Just to see if anyone can help me out, i'm sure its very very basic but I've only just flipped to mac from windows and learning the terminal basics
I am trying to install and use Symfony, i have installed homebrew, then i put in the composer command-
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
it downloads and installs but then it says i the path/ directory is not valid/ now i understand i need to make it, but i'm not sure where this will lie, and what is the command to make a director? is it mkdir -- ?
heres the terminal log-
Calvins-MacBook-Pro:~ calvin$ curl -sS https://getcomposer.org/installer | php
#!/usr/bin/env php
All settings correct for using Composer
Downloading...
mv composer.phar /usr/local/bin/composer
Composer successfully installed to: /Users/calvin/composer.phar
Use it: php composer.phar
Calvins-MacBook-Pro:~ calvin$ mv composer.phar /usr/local/bin/composer
mv: rename composer.phar to /usr/local/bin/composer: No such file or directory
Calvins-MacBook-Pro:~ calvin$
https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx
Note: In OSX Yosemite the /usr directory does not exist by default. If
you receive the error "/usr/local/bin/composer: No such file or
directory" then you must create /usr/local/bin/ manually before
proceeding.
To create an directory you need to execute:
sudo mkdir <path>

need help installing drush on mac

I'm on a mac. And I user MAMP a lot. I'm pretty new to command line and I'm trying to install Drush. I see I need to install composer first (according to what I read at drush-ops, so I did. Here's the commands I put in:
my-MacBook-Pro:~ mycomputername$ curl -s https://getcomposer.org/installer | php
#!/usr/bin/env php
All settings correct for using Composer
Downloading...
Composer successfully installed to: /Users/myname/composer.phar
Use it: php composer.phar
my-MacBook-Pro:~ mycomputername$ mv composer.phar /usr/local/bin/composer
mv: rename composer.phar to /usr/local/bin/composer: Permission denied
my-MacBook-Pro:~ mycomputername$ sudo mv composer.phar /usr/local/bin/composer
Password:
after which I did a command "composer about" to check and I got something back so I know it installed. so when i entered:
my-MacBook-Pro:~ mycomputername$ composer global require drush/drush:6.*
Changed current directory to /Users/myname/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing drush/drush (6.2.0)
Downloading: 100%
Writing lock file
Generating autoload files
...and did a "drush status" I got:
my-MacBook-Pro:~ mycomputername$ drush status
-bash: drush: command not found
...so apparently it installed but I should be able to find it. What should I do next? do i need to create and alias or what?
When running drush status you should get something like this
PHP executable : /Applications/MAMP/bin/php/php5.5.10/bin/php
PHP configuration : /Applications/MAMP/bin/php/php5.5.10/conf/php.ini
PHP OS : Darwin
Drush version : 6.2.0
Drush configuration :
Drush alias files :
I installed drush doing just this command
brew install drush
Brew is very helpful to install things in command line, I recommend you install brew.
(http://brew.sh/)
Much simpler answer! Just quote the version string :) You don't need to switch to Brew from Composer.
composer global require "drush/drush:7.*"
Here's more info about using Composer to manage Drush...
http://whaaat.com/installing-drush-8-using-composer
Download drush.tar.gz to your desktop (or wherever)
Jump across to the Terminal
cd ~/Desktop
Extract it with
tar -zxf drush.tar.gz
Move it to /usr/local/lib
sudo mv drush /usr/local/lib/
Make it executable
sudo chmod u+x /usr/local/lib/drush/drush
Then stick it in /usr/bin/ so that you can run it from anywhere
sudo ln -s /usr/local/lib/drush/drush /usr/bin/drush

Trying to install composer to get set up with Laravel framework

I am trying to install composer on my Mac so that I can use the Laravel framework. I successfully downloaded composer through the terminal, and then I moved composer.phar to to usr/local/bin using the command: sudo mv composer.phar /usr/local/bin.
I then changed directories to my root directory where I have the laravel-master files. After changing to this directory in the terminal, and then using the command: composer install
I receive the error: -bash: composer: command not found
I have tried other variations (such as php composer.phar install, etc..), however, I keep receiving the same error.
Any help would be much appreciated. Thank you!
Make sure that /usr/local/bin is in your $PATH
$ echo $PATH
Then execute
$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
^^^^^^^^ you didn't rename it
For reference see
Installing composer.phar globally on *nix
I'm running Mavericks and had same problem. I changed /usr/local/bin/composer to /usr/bin/composer and it worked for me.
for mac os x Mavericks and Yosemite El capitan
Change
sudo mv composer.phar /usr/local/bin/composer
To
sudo mv composer.phar /usr/bin/composer
Now if you just write composer in terminal, it will show you all available commands
Then "if running MAMP" navagate you htdocs folder and run
composer create-project laravel/laravel laratest
Hope that helps
A quick copy-paste version including sudo:
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Now in 2017 I am using MacOS SIERRA 10.12.6 and sudo mv composer.phar /usr/bin/composer doesn't work. It works for me sudo mv composer.phar /usr/local/bin/composer. Now I can run composer instead of php composer.pha

Resources