使用 MAMP 在 OSX 上安装 composer [英] Installing composer on OSX with MAMP

查看:32
本文介绍了使用 MAMP 在 OSX 上安装 composer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 MAMP 在 OSX 上安装 composer 并使用了 本指南,但是它似乎不起作用.

I'm trying to install composer on OSX with MAMP and have used this guide, but it doesn't seem to be working.

在最后一步我收到以下错误:

On the final step I get the following error:

mv: rename composer.phar to /usr/local/bin/composer: No such file or directory

有谁知道可能出了什么问题?我正在使用 OSX 10.9.5 和 MAMP 3.0.7.3 和 PHP 版本 5.6.2.

Does anyone know what could be wrong? I'm using OSX 10.9.5 and MAMP 3.0.7.3 and PHP version 5.6.2.

推荐答案

下载 composer.phar 并将其保存到您的项目文件夹中:http://getcomposer.org/composer.phar

Download composer.phar and save it into your project folder: http://getcomposer.org/composer.phar

然后打开你的终端并输入:

Then open your terminal and type:

nano ~/.bash_profile

文件打开后,输入以下代码

Once the file is open, enter the following code

alias composer='php ~/composer.phar'
export PATH=/Applications/MAMP/bin/php/php7.0.10/bin:$PATH

请注意,我目前正在使用 php7.0.10 版本.只需使用您正在使用的 php 版本自定义上面的代码.

Please note that I am currently working with php7.0.10 version. Just customize the code above with the php version you're working with.

ctrl+o 保存文件
ctrl+m 确认格式
ctrl+x 关闭文件

ctrl+o to save the file
ctrl+m to confirm format
ctrl+x to close the file

现在重新加载配置文件

source ~/.bash_profile

提示 composer 以检查是否正常工作

Tipe composer in order to check if is working

   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ / __ `__ / __ / __ / ___/ _ / ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.2.2

如果上面的文字显示了,那么你就可以开始了!

if the text above is shown, then you're ready to go!

这篇关于使用 MAMP 在 OSX 上安装 composer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆