got a crush on drush
How I got drush to work on my macosx with mamp pro, and still my illustrator & photoshop works fine, how to do magick stuff with the terminal with out deleting to much, and learning not to use my pen to navigate my desktop...
This is very basic and written with the drupal front end geek that dont have the hots for a terminal window, so some of this might seem very basic, but hopefully this can get more of us front end geeks on the wagon of Drupal über power drush magick.
This obscure need to look into drush came from a comment last week that ment that designers really should look into drush - well okay then lets take a look at it!
"drush is a command line shell and Unix scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt."
Well if it can save me a ton of hours of downloading, updating etc, then im all for it. Then theres so much more time to do fun stuff, like debugging ie or getting a cold brew
lets get drush
Download drush from drupal.org and unpacked it then place it somewhere on your mac
I have place the drush folder mine in my home dir (which is /mortendk/)
Remember to replaced [HOME] in your own install ;)
The drush folder dont have to be in your drupal installation, cause its really just a bunch of scripts that the terminal (or cli as the nerds calls it) uses. So no worries
Make the 'drush' command executable:
Following the drush manual
says that drush needs to "Make the 'drush' command executable:" ahem ooh well that basically means that you need to change some of the permissions
So open the terminal app
The .bash_profile adventure
My knowledge of this is not so big (aka not existing) but a .bash_profile file gives the terminal all kinds of presets for paths, and other stuff This is set so its gonna be easy to fire off drush commands from ther terminal else you have to write "/path/to/drush/drush" + the command instead of just drush + command. to get the magic to happen
(if you have a better explanation i would love to hear it!)
Bit back to the terminal and get that path thing to work:
- make sure we are in our home dir
this command will get you home: "$ cd ~"
- open up a bash_profile file in the terminal do this "nano .bash_profile"
and then put this in
alias drush="/Applications/MAMP/bin/php5/bin/php /Users/[HOME]/drush/drush.php"
Hopefully you gonna get a window that looks like this:
To actually save this hit ctrl-x that will take you to a new "page" in the terminal where you say "Y" for yes to saving the .bash_profile
- test it
so lets check it out try to do a "drush" in your terminal - hopefyll it gives you something like this:
okay so lets make something with this drush:
In the terminal do this: make a new folder (teststuff) and download drupal to that folder with a single command: dl drupal
- $ cd sites (go to the site folder)
- $ mkdir teststuff (make a new folder called teststuff)
- $ cd teststuff (go to the teststuff folder)
- $ drush dl drupal (download drupal into the teststuff folder)
- wait a little bit
- "Project drupal (6.14) downloaded to /Users/mortendk/sites/teststuff/.[success]"
So that was pretty öwesome (yup thats awesome +1) It really begins to be really cool when you have a working drupal site. Before we go down that road lets just fix the memory in the mamp so we can kick some ass.
Memory mamp fix
Mamp comes with its php memory set to 8MB ... ahem so lets just fix that - else you will end up with a bunch of errors in the terminal and youll end up whining in the corner (or on IRC )
The problem here is that if you uses mamp as your webserver, the terminal cant really figure out where it should read the php configuration from as its described here
So to win the battle with memory problems in you php installation you need to do a little fine tuning of the php.ini files inside the mamp installation - its pretty simple to fix in mamp go to the mamp/conf/php5/php.ini
and search for "memory_limit" change that to something ass kicking like
memory_limit = 512M
To get drush to work with the your drupal site you need to navigate into your drupal site so in this setup i just do something like:
and now you ready to rock with drush:
- drush status
status of the drupal installation
- drush update
update all the modules - yeah baby!
- drush cron
run cron on the site
- drush cache clear
clear the cache
sharing the love
Im pretty sure theres a hell of a lot more cool ways of using drush -pretty sure the comments will be full with ideas ;).
I just wanted to share this with the rest of the world - now I have a place to find out how to get it to work again...
So to get all this comment line terminal crap to work I had to work a little (mostly with beeing frustrated) and rely on loads of help from the drupal community, looks like i had some points on the drupal karma account so thanx @mikl, @beeradb, @rightsprocket, @jacine, cll, & @threehz that used their time to help me through this experience -and not to forget moshe, owen & adrian who made this tool that made me use a terminal by my own free will ;)
- drush readme
- modules that supports drush
- screencast: Installing and Getting Started from civic action
- screencast #2 rom civic action
- offcourse theres always the more beer argument ;)
*yeah ! tee's
a guide for us that a terrified of that terminal:
Lullabot documentation Rock star @add1sun is doing a bunch of videos about the cli :):