需要帮助在mac上安装drush

时间:2014-04-18 22:05:55

标签: terminal composer-php drush

我在Mac上。我经常使用MAMP。我是命令行的新手,我正在尝试安装Drush。我看到我需要先安装作曲家(根据我在drush-ops上看到的内容,所以我做了。这是我输入的命令:

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:

之后我做了一个命令“composer about”进行检查,我得到了一些东西,所以我知道它安装了。所以当我进入时:

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)

- 安装drush / drush(6.2.0)     下载:100%

Writing lock file
Generating autoload files

......并且我得到了一个“溺水状态”:

my-MacBook-Pro:~ mycomputername$ drush status
-bash: drush: command not found

......显然已安装但我应该能够找到它。接下来我该怎么办?我需要创建和别名或什么?

3 个答案:

答案 0 :(得分:2)

运行drush status时,你应该得到类似的东西

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     :                                                    

我安装drush只做这个命令

brew install drush

Brew在命令行中安装很有帮助,我建议您安装brew(http://brew.sh/)

答案 1 :(得分:1)

更简单的答案!只需引用版本字符串:)您无需从Composer切换到Brew。

composer global require "drush/drush:7.*"

以下是有关使用Composer管理Drush的更多信息... http://whaaat.com/installing-drush-8-using-composer

答案 2 :(得分:0)

  1. 将drush.tar.gz下载到您的桌面(或任何地方)

  2. 跳转到终端 cd~ / Desktop

  3. 用它提取 tar -zxf drush.tar.gz

  4. 将其移至/ usr / local / lib sudo mv drush / usr / local / lib /

  5. 使其可执行 sudo chmod u + x / usr / local / lib / drush / drush

  6. 然后将其粘贴在/ usr / bin /中,以便您可以从任何地方运行它 sudo ln -s / usr / local / lib / drush / drush / usr / bin / drush