MAMP + Mac Lion + WordPress + FTP + auto update: The ultimate (?) solution

If you are like me, you have been searching forever to get the auto update for plugins and core up and running in your WordPress install in MAMP PRO version 2 on your Mac running Lion. Since the MAMP forums don’t seem to provide much support on the topic, I’m going to share how I made it work for me.
Please don’t expect me to fix it for you if it doesn’t work for you! I’m not a command-line kind of guy and most likely won’t be able to answer any of your questions. Just try this approach if you’re desperate enough – for me it worked like a charm!

Original source: (Thanks a bunch!) URL disappeared from the internet lately. 🙁
Terminology: Folder or directory or dir = all the same thing here.

1. Premises

  • You have MAMP PRO 2.something installed on your Mac. (It might work with just MAMP [no PRO] or in any version before 2, but I’ve only done it in this particular version.)
  • Your Mac runs OS 10.7.3 Lion. (Again, anything before that or later might work, but I’ve only done it on that particular version.)
  • Your user account on your Mac has admin rights, meaning you can install software (you won’t have to, don’t worry) and things like that. If you’re the only user on your Mac, there’s a 99.99% chance you’re fine.
  • You have WordPress installed in a subfolder of your Sites folder. Therefore, the path to your WordPress folder on your Mac looks similar to this: /Users/YourMacUsername/Sites/your-wordpress-root-folder
    • …where YourMacUsername is your username, of course. If your real name is Peter, it might be Peter or peter or whatever. So, whenever you see YourMacUsername here, you know what to replace it with, right?
    • …and your-wordpress-root-folder is the root folder of your WordPress install. (That’s is the folder where you find your wp-config.php file, remember?) If you have installed WordPress just out-of-the-box, the name of your-wordpress-root-folder is actually wordpress.

Savvy so far?

2. What to do

  • READ THIS POST ONCE FROM TOP TO BOTTOM AND UNDERSTAND IT BEFORE YOU START DOING ANYTHING! It can be a major pita finding yourself in the middle of making modifications on your computer you don’t understand and deciding you’d rather revert them. So read first, then start doing something.
  • Open the wp-config.php file in your WordPress root folder and find the lines at the end of the file where it says:

    [php]/** Absolute path to the WordPress directory. */
    if ( !defined(‘ABSPATH’) )
    define(‘ABSPATH’, dirname(__FILE__) . ‘/’);[/php]

  • Anywhere BEFORE those lines add this:

    [php]define(‘FS_METHOD’, ‘direct’);[/php]

    This will prevent WordPress form asking for your FTP credentials when running the automatic update process.

  • Save and close the wp-config.php file.
  • Open the Terminal application on your Mac. I hate it, too, just do it. If you don’t know where it is, do a search for Terminal in your Finder.
  • You have to type several things into the Terminal window now. If you’re like me, you would just paste them there. In order to do so, write out the following lines in a text editor first (TextEdit, Coda, whatever) and make the changes you have to apply; then paste them into the Terminal window one by one and hit Enter after each one.
    1. Type in cd /Users/YourMacUsername/Sites and hit Enter. Remember to replace YourMacUsername appropriately!
    2. Type in: sudo chown -R :_www your-wordpress-root-folder Remember to replace your-wordpress-root-folder appropriately! Then hit Enter.
    3. You’ll be prompted for your password by the Terminal now. Just type in the password of your Mac user account (not WordPress account!!). Don’t worry if your password doesn’t show up while you’re typing, that’s fine. When you’ve typed it out, hit Enter. The Terminal just jumps to the next line. Don’t worry about anything left of the $ sign.
    4. Type in: sudo chmod -R g+w your-wordpress-root-folder Remember to replace… you know the deal by now, don’t you? Then hit Enter.
  • Finished. Try to run an auto update in your WordPress install now. For example, update a plugin that needs to be updated, or delete one that needs to be deleted. But beware: from now on WordPress will not ask you twice before updating or deleting files, it’ll just go straight ahead and do what you told it to do! (This doesn’t affect your normal workflow when you edit posts or pages, of course. The editor will act just as it it did before and double-ask for allowance before applying any changes.)

Hope this helps a lot of you out there. Again, if you run into trouble, please don’t let me know – as I said, I won’t be able to fix it for you. If you find a better solution or any modifications to this one that might be useful for others, please don’t hesitate to post them here.

8 thoughts on “MAMP + Mac Lion + WordPress + FTP + auto update: The ultimate (?) solution

  1. Your fix worked easily and quickly. The problem is nasty and took hours to research. Thanks

  2. Thank you very much! Been searching for over a day for this fix and it worked! Thanks for the well written, easy-to-follow instructions.

Comments are closed.