0

Tried to get Sass & Compass working on Windows, but ran into too many problems. Now I have purchased a vintage Macbook Pro (2008). I finally got Drush working on Windows, but I can't seem to get Drush to work on the Macbook.

ON THE MAC: I am using a MAMP-Stack. I tried installing Drush-6.0, but it began to ask for 'Composer' and other such further complications. I installed Pear, but could not figure out the instructions to use Pear to install Drush. So I tried a simple install of Drush-6.0 from a Tar file Download. I installed it to the '/Applications/MAMP/htdocs' Folder. It could download Modules and Themes, but Drush could not do a simple Status check or Cache-Clear. Somehow it could not interact with Drupal.

Next I tried a Zip Download of Drush-5.9. I removed the previous Drush-6.0 from the 'htdocs' Folder with 'rm -rf drush'. I installed Drupal-5.9 by pulling the Zip into my Folder. Then I did a 'chmod u+x drush' in the working directory of drush. Then in the same HOME Folder, I edited the .bash_profile and .bashrc Files in Vim. There is nothing in either of those two files that refers to the previous Drush Path (htdocs) from the previous installation, but now they instead point to the new installation of Drush-5.9 (In the '/Users/MY-NAME/' Folder.

However, when I try to launch Drush, Drush can do a status-report. It reports Drupal, but incorrectly reports the Garland-Theme being used, which is NOT the Default Theme. By the way this same output happens if I am in the Omega-Theme working directory or the Drupal-Root working directory.

Drush also fails to accomplish a simple 'drush cc' (only the Drush-Cache is available to clear). Drush cannot do a 'drush pm-list', instead I get an error message about Drush not being able to bootstrap the Drupal Database.

I read the 'read-me' in the Drush-Installation-Folder and tried to follow the prescription for changing my PHP direcory in .bash_profile. Then trying to follow the instructions for configuring php.ini, I got lost at the point where you try to find out what version of php your Webserver is using (I presume this means MAMP, maybe not).

Now I am at a loss as what to do next to get Drush functional. Any help is greatly appreciated.

BASH_PROFILE:

# Set Architecture flags

export ARCHFLAGS="-arch x86_64"

#Ensure user-installed binaries take presidence

export PATH=/usr/local/bin:$PATH

export PATH=/Users/ChandraSwami/pear/bin:$PATH

export PATH=/Users/ChandraSwami/Dev:$PATH

export PATH="$PATH:/Users/ChandraSwami/drush:/usr/local/bin"

export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.4.24/bin:$PATH"

#Load .bashrc if it exists

test -f ~/.bashrc && source ~/.bashrc

:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a
function*

source ~/.profile


END-BASH_PROFILE
  • The contents of your .bash_profile would be useful. – beth Sep 15 '14 at 19:54
  • if you run a drush command with the params -vd it will give you more thorough debugging output that may be useful in resolving your problem. This should at least tell you what php.ini is being used. – rooby Sep 16 '14 at 5:23
  • It is quite possible that your drush isn't using your WAMP version of PHP so it doesn't have mysql support and fails when it tries to do database stuff. – rooby Sep 16 '14 at 5:24
  • rooby might be right. I am using multiple versions of drush (5,6,7) on my MacBook Pro and ran into similar problems. It's quite possible that drush is not using the correct php.ini file, see drupal.org/node/1465956#comment-5793124 for details. – Paul Sep 16 '14 at 6:53
  • gross you're still using RVM :P haha. RbEnv is alot less intrusive into your system: rubyinside.com/… – tenken Sep 22 '14 at 20:46
2

RESOLVED. 9/22/2014

I began to discover that the previous method of attempting to change the 'alias' or otherwise redirecting Drush to use MAMP's PHP was the wrong way to go. Especially 'name-distorting' the original MacBook-OS-PHP so that Drush would opt for the MAMP-PHP was causing all kinds of problems with other software, as might be expected. I don't know how this method came to be recommended, but it appears that it is actually a pit-fall.

The way better approach (watch me eat my words in a few weeks), is to rather just upgrade the MacBook-OS-PHP to the same or nearly same version as the MAMP-PHP. Then it does not matter which version of PHP Drush or anything else uses because they are both the same. This overcomes all the issues and is not that difficult to accomplish. At least on my platform which is a MacBook-Pro (2008-Mavericks).

The way that I upgraded my MacBook-OS-PHP was by the CLI-command "curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5".

This is a download from a group of developers in Germany which upgrades your PHP. Check out "http://php-osx.liip.ch/".

Once my System-PHP and MAMP-PHP were almost the same, all my issues with Drush went away. I undid all my 'aliases', 'redirects' and 'name-distortions'. So far all is working well.

Note that on my machine MAMP is using PHP-5.5.14 and my CLI reports with a "php -v" command that MacBook-OS is using PHP-5.4.30 though I am not sure that the version is accurate. In the write up on the PHP-Upgrade it mentions that the version might not be accurate.

By the way this does not OVERWRITE your previous PHP installation but rather just adds a newer installation and directs your system to use it.

I will update if there later prove to be drawbacks in this approach.

-1

RESOLVED (Now Deprecated in favor of the more recent recommended solution.)

Yes it was the fact that there were different versions of PHP at play here. That was the whole issue.

After reading rooby's & Paul's comments, I checked out "drupal.org/node/1465956#comment-5793124". Of course my set up was different, but I just tried to do the best I could by substituting my own environment for the details that jorgensean/teckgirlgeek used and IT WORKED!!

I am using MAMP because it is the 'Suggested Best' Stack by Drupal.Org users and MAMP uses (as of 09/15/2014) Php 5.5.14. On my MacBook-Pro-2008 this is located at "/Applications/MAMP/bin/php/php5.5.14/bin/php" with the last php being the actual PHP file. That location was chosen by MAMP itself; I did not choose it.

My Drush.php is installed at "/Users/MY_NAME/drush/drush.php" again with the last drush.php being the actual file. This is my Drush-Install Directory. My Drupal-Install is at "/Applications/MAMP/htdocs/drupal7".

As I understand, the crux of the issue is that Drush will default to the MacBook-Pro pre-installed version of PHP which conflicts with the version of PHP which MAMP (or whatever your Stack) is using. This Default MacBook-PHP is in the "usr/bin" Directory. I renamed the PHP-file from php to php-2014-09-15 using the "mv php php-2014-09-15" command.

Originally I followed the instruction of modifying the '.profile' hidden file, but later, reading jorgensean's comment, I undid that modification.

What succeeded was altering the '.bash_profile' file in the Root-Directory. Following the pattern set up by jorgensean. I added the following two lines:

export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.5.14/bin:$PATH"

alias drush='/Applications/MAMP/bin/php/php5.5.14/bin/php /Users/MY_NAME/drush/drush.php'

From my small understanding, the first statement in the .bash_profile sets the PATH to the desired PHP-5.5.14 file and the second statement tells the OS to substitute the MAMP PHP-5.5.14 for the original PHP that Drush is looking for.

Anyone else with this issue will likely have some differences in their configuration and will have to adjust accordingly.

The essence is that you have to block the original MacBook-PHP file by renaming it. (PS remember what you renamed it, in case you ever have to change it back. I am not able to say whether this will cause any issues with any other programs other than MAMP & Drush.) Then modify your .bash_profile in the Root Directory with Vim or whatever to set a PATH to the MAMP-PHP file and alias the Drupal-PHP to point to the MAMP-PHP.

End of story.

Hope this helps someone else and thanx to all those who made this information available!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.