I used this tutorial to get MAMP up and running.
The next mission is getting drush to work on this setup.
1. Downloaded latest version of Drush to my Desktop and unzipped.
2. Dragged the unzipped directory to /usr/bin/drush
3. Chmoded /usr/bin/drush/drush to become executable as instructed in README.txt.
4. Created the following alias to drush in spencerHD/Users/spencer/.profile):
alias drush='/usr/bin/drush/drush'
5. Logged out and logged back in.
6. Navigated to my Drupal 6.14 site at Applications/MAMP/htdocs/localttc and tried "drush status" but no luck. -bash: drush: command not found
I'm curious to know if I did something wrong or need to look at another angle to get this running. It looks like a great module so if you have any suggestions or tips I'd be grateful.
Thank you very much.
Comments
Drush shouldn't need an alias
Drush shouldn't need an alias if you've put it in /usr/bin - you need to read the installation instructions a bit more carefully!
Try typing this though - DON'T log out afterwards;
source /spencerHD/Users/spencer/.profile
Then try the drush command...
Pobster
...
what works for me is this (in .bash_profile, not in .profile):
you have to tell drush to use the MAMP version of php as the system one is different.
Excellent, that did the
Excellent, that did the trick. Thanks a lot for your help markabur! :)
Works for me.Thanks.
Works for me.Thanks.
The only source of knowledge is experience. ~ Albert Einstein.
OS X 10.6 + MAMP 1.9 + Drush = problems
I had big problems with a OS_X_10.6 + MAMP_1.9 + drush setup, but I solved the issues so I thought I'd post it here in case anyone else was bumping into similar issues. Though if anyone has ideas why some of these problems were popping up - sharing that info would be much appreciated.
If you are using MAMP and want to use drush, install drush as directed in the README but use the php located in /Applications/MAMP/bin/php5.2/bin
chmod +x /Applications/MAMP/bin/php5.2/bin/php
otherwise you will receive permission errors such as...
memory_limit
from 32M to 96M or 128M or greater here:/Applications/MAMP/conf/php5.2/php.ini
Note that you can also use the php located in /Applications/MAMP/bin/php5.3/bin but I got a bunch of warnings/errors with drush when I did that due to various modules I was using that aren't 5.3 compatible (or haven't been upgraded to versions that are 5.3 compatible). Likewise MAMP can be set to use php 5.2 or 5.3 - with similar results regarding warnings/errors that will pop up inside drupal admin pages.
Regarding my experience with using Mac's default PHP...
I recently upgraded to Snow Leopard (10.6) and also upgraded my MAMP to 1.9 (released: 2010-04-16). At each stage I tested my local sites and they were working fine.
Reinstalled drush and the first round of warnings/errors began. I was just using the default Mac provided php and received various warnings...
and sometimes errors...
Just for the record the site was already installed and had a working configured database.
Also I've installed a mysql server on my mac via fink previously, but I am not using it and it is not running. Still - not sure if some of these Mac default php problems I was experiencing are due to some settings my mysql installation created somewhere or something that's the usual experience for people using 10.6.
After all this I opted to try to use the php supplied in MAMP and after some trial and error arrived at the steps shown in the list above.
more errors - try the hard link approach
my approach listed above worked fine (just changing your .bash_profile) for a while, but today I tried to update my modules and core, but ran into a similar set of errors when drush tried to updatedb.
see this node for another approach using hard links and further discussion.
How do you tell mamp to use
How do you tell mamp to use php 5.2?
There's an option to chose
There's an option to chose 5.3.x or 5.2.x in the server menus, it's in the documentation;
...Come on, you really could have Googled that?... That's just pure laziness!
Pobster
On the Mamp control panel go
On the Mamp control panel go preferences -> PHP and there is an option for 5.2 or 5.3
MAMP 2.0.1
php executable is in a new location with this version of MAMP (PRO).
So in your ~/.bash_profile or ~/.bash_exports the correct PATH export for drush to work is:
or
.../php5.3.6/bin
as appropriate to your set up.confirm that the symbolic
confirm that the symbolic link as explained in http://drupal.org/node/726970#comment-2914148 works for mamp 2.0.3 and osx 10.7.1:
sudo ln -f /Applications/MAMP/bin/php/php5.3.6/bin/php /usr/bin/php
Confirm symbolic link for MAMP 2.0.5 and Lion 1.7.2
@batigolix: Thanks. I also confirm the symbolic link fix for MAMP 2.0.5 and Lion 1.7.2.
Cheers.
/*_*/
http://www.xmacinfo.com
Confirmed for Mac 10.8.4 with MAMP 2.1.4
Had a few issues with the same errors when trying to run 'drush cc' or 'drush core-cron' with a migrated Drupal site onto my local machine.
Worked for me:
export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.4.10/bin:$PATH"
Thanks @batigolix
Drush on MAMP v2
I have had a lot for problems in the past to get drush to play nice with MAMP.
Here is my guide and it seem to work fine.
Note MAMP should be running
1. Download drush from http://drupal.org/project/drush
2. Move the downloaded file to the desktop
3. Decompress the downloaded file
4. Open terminal
5. Create a new folder for drush
Terminal command: sudo mkdir /usr/local
6. Move the drush to new folder
Terminal command: sudo mv ~/Desktop/drush /usr/local
7. Make drush folder writable so self update will work
Terminal command: sudo chmod 0777 /usr/local/drush/
8. Make drush executable
Terminal command: sudo chmod u+x /usr/local/drush/drush
9. Create symbolic link so MAMP php is the default php
Terminal command:
sudo ln -fs /Applications/MAMP/bin/php/php5.3.6/bin/php /usr/bin/php
10. Create symbolic link so MAMP mysql is default mysql
We need 2
Terminal command:
sudo ln -fs /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
sudo mkdir /var/mysql
sudo ln -fs /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql/mysql.sock
11. Create a .profile file. So you can execute drush from anywhere
Terminal command: sudo nano.profile
Then copy and past the below from start to end
#START
alias drush='/Applications/MAMP/bin/php/php5.3.6/bin/php /usr/local/drush/drush.php'
export PHP_VERSION="5.3.6"
# HOME folders
export MAMP_HOME="/Applications/MAMP"
export PHP_HOME="$MAMP_HOME/bin/php$PHP_VERSION"
# DRUSH
export DRUSH_PHP="$PHP_HOME/bin/php"
# PATH
export PATH="$MAMP_HOME/bin:$PATH"
export PATH="$MAMP_HOME/Library/bin:$PATH"
export PATH="$PHP_HOME/bin:$PATH"
#END
12. Then save the .profile file
Press: Control + x
Press: y
Press: return
13. Quit terminal to reload .profile file
14. Drush should now be working
Terminal command: drush
This should return a bunch drush related commands
Terminal command: mysql
This should give the a mysql prompt
Code should read like well written English
problem with step 10?
Problem with last terminal command in step 10:
'/tmp/mysql/mysql.sock' No such file or directory.
Step 10
I suspect the line in step 10 is supposed to be this:
sudo ln -fs /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock
Typo in step 11
should have a space after 'nano' so it reads
It's minor but it's likely to trip up some noobs.
not working
I followed the steps but neither "drush" or "mysql" is working. I restarted the whole system but still nothing.
Thanks! and a couple of comments
I'm just installing drush locally and this saved me a lot of work so thanks for that!
As mentioned drush was accessing Mac OSX' native php in /private/etc/php and seemed to get lost with the native MySQL instance as well. Some tweaks:
Step 9:
Note that php executable in MAMP has moved within the current version (2.0.5) one level deeper so now default path is: /Applications/MAMP/bin/php/phpversion/bin/php
In my case I added the extra task to rename the native php executable to php.original prior to setting the soft link to MAMP's php.
mv /usr/bin/php /usr/bin/php.original
I also did took the same steps with php-config - renamed the native and linked to the one in MAMP.
Step 10:
Rather than link only to the mysql.sock in MAMP I linked to the entire directory as the .pid is also included now:
sudo ln -s /Applications/MAMP/tmp/mysql /var/mysql
Step 11;
As I am using bash I already had a .bash_profile so I copied the lines you indicated (with the tweaks as just mentioned) into that rather than creating the .profile.
After clearing drush's cache, it now seems to be running fine and using the mysql and php instances that the local sites use.
Thanks again for the clean documentation!
New official Drush install procedure
Drush as now a new very efficient way to install Drush that is compatible with MAMP.
Once installed like this, upgrading through pear is quick and easy.
/*_*/
http://www.xmacinfo.com
This worked for me, so much
This worked for me, so much easier than trying to do it manually
@alexanansi
Symlink does the trick
After beating my head against the wall, I found this did the trick:
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock
No more errors, and Drush works as expected within the local site install.
Sorry guys, but you cannot
Sorry guys, but you cannot use /usr/bin/ folder for drush. Because this folder for system bins only.
For custom bins we must use folder like /usr/local/bin/
But unfortunately OSX don't use this folder by default =)
For fix it we can add "PATH=$PATH:/usr/local/bin" to ~/.bash_profile
But drush is not just bin, it's folder with files.
Because of this we need to copy it to /opt/ folder and create symlink to /usr/local/bin
So, this is more "Linux way":
Hi mrded, looks to me like
Hi mrded,
looks to me like you know your way around Mac :) I am a recent convert from PC so I don't :P anyways.... I hope you can help me setup drush properly
I Installed it using
command and it seems to be working but i can't really use it because its not connecting to my MAMP Pro php and I have no idea how to access .bash_profile to make changes....
Where is my .bash_profile now and how do I access it to make changes?
Thanks in advance
Brisbane Web Design, Development and SEO consulting services.
www.webmar.com.au
created .bash profile file
but and added following line to it
export PATH=/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.3.14/bin:$PATH
and I also didsudo mkdir /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock/code> but I am still getting Command field-info needs a higher bootstrap level to run - you will [error]
need to invoke drush from a more functional Drupal environment to run
this command.
The drush command 'field-info' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This may occur when Drush is trying to:
* bootstrap a site that has not been installed or does not have a
configured database. In this case you can select another site with a
working database setup by specifying the URI to use with the --uri
parameter on the command line. See `drush topic docs-aliases` for
details.
* connect the database through a socket. The socket file may be
wrong or the php-cli may have no access to it in a jailed shell. See
http://drupal.org/node/1428638 for details.
help anyone?
btw I am running on Mountain Lion
Brisbane Web Design, Development and SEO consulting services.
www.webmar.com.au
Same issue on Lion, anyone
Same issue on Lion, anyone figure it out?
Also when I run
sudo ln -fs /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock
I get
ln: /tmp/mysql/mysql.sock: No such file or directory
Lion Fix
You need to create the folder first, on Lion.
So, the steps are:
Port 8889
Be sure you've also got port 8889 (if you're using MAMP default) specified in your database area of settings.php (hat tip).