OSX -bash: composer: command not found

前端 未结 10 1025
我寻月下人不归
我寻月下人不归 2020-12-22 18:52

If i type \"composer\" i get the above error message.

I did on my macbook:

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /us         


        
10条回答
  •  臣服心动
    2020-12-22 19:22

    Composer is avialble and install the packages in the global path but they are not available in the shell, Mac in my case. I managed to fix this by adding the global bin to the path at my bash file.

    Steps:

    First, check what is your home directory by typing in the shell:

    cd ~
    pwd
    

    this will tell you the home path

    The next step is to verify that composer set the global directory there:

    ls -al .composer
    

    If you got list of files that's mean composer set up the directory, if not - look above or in the documentation.

    The next step is to edit the bash profile. Mine is ~/.bash_profile but other can ~/.zshrc. If you don't have any one like this try to see how to set up aliases and place the the code in aliases file:

    PATH="YOUR_HOME_PATH/.composer/vendor/bin:${PATH}"
    export PATH
    

    That's it! just reload the file with

    source PATH_TO_FILE
    

    And you good to go!

提交回复
热议问题