TextMate FTP SSH Bundle Snow Leopard FIX

I use the FTP/SSH bundle for TextMate a lot and have gotten quite used to it.  It is quirky, but it has become an invaluable part of my development process.  When I upgraded to Snow Leopard, the bundle stopped working.

There are two fixes you need to apply.

The first fix

The first fixes problems if you’re getting errors like:

PHP Notice: Undefined index TM_PROJECT_FILEPATH
PHP Notice: Undefined index TM_DIRECTORY

You need to alter your /private/etc/php.ini file. If you don’t have one, just copy the /private/etc/php.ini.default file to /private/etc/php.ini. Look for this line:

variables_order = “GPCS”

Change it to:

variables_order = “GPCSE”

The second fix

Snow Leopard ships with PHP 5.3, which, in its default configuration, doesn’t recognize the $_ENV superglobal.  You have to call getenv() instead.  Since the FTP/SSH bundle relies heavily on the $_ENV variable, it breaks under Snow Leopard.  Luckily, there’s an easy fix.

The Solution

Open up TextMate and open the following folder:

/Users/your_username/Library/Application Support/TextMate/Pristine Copy/Bundles/FTP:SSH.tmbundle/

Use shift+cmd+f to do a global find/replace. For find, enter this:

\$_ENV\['([A-Z_]+)'\]

For replace, enter this:

getenv('$1')

Make sure you check the “Regular expression” box and click Find and then Replace All.

That’s it.  The bundle should start working properly.

7 Responses to “TextMate FTP SSH Bundle Snow Leopard FIX”

  1. J. Adam Moore says:

    Global replace does not work. Your instructions do not work as written. A fresh install of TextMate and following your instructions fails every time.

  2. J. Adam Moore says:

    You forgot to escape the dollar sign.

  3. Clay Simmons says:

    Oops! Thanks for pointing that out. Does the fix work for you now?

  4. Jeff says:

    not working for me either…

  5. Clay Simmons says:

    It seems that the bundle still breaks if a .ftpssh_settings file DOES NOT already exist in the project directory. Just copy one of your .ftpssh_settings files from another project and edit the values. The bundle will work with this fix after that.

  6. Vincent says:

    so when you say you need to escape the dollar sign, you mean to replace:

    getenv(‘$1′)

    with:

    getenv(‘\$1′)

    ?

  7. Clay Simmons says:

    No. The post, as originally written, called for this: $_ENV\['([A-Z_]+)’\] to be entered into the “Find” box. But you have to escape the dollar sign and instead put \$_ENV\['([A-Z_]+)’\] in the “Find” box for it to work.

Leave a Reply