Skip directly to content

Mac OS X (DAMP) to Pantheon tips

Kelly Bell's picture
on Wed, 01/19/2011 - 1:31pm

Pantheon is an amazing product. I am thrilled that we are able to participate as beta users in their product. However, as with all beta products, some of the "nice-to-haves" are not quite in place yet, as they focus on polishing the "must-haves" first (and the must-haves are truly delightful in Pantheon's implementation). As a Mac OS X users, and having become addicted to using DAMP for my local development environment, there are a few hurdles to overcome to make the workflow smooth and fast. In this post I will share with you the techniques I've uncovered, which I use every day, which make my Pantheon workflow run a little smoother. Please note that code snippets are located at the end of this post.

Using this system can allow you to work from either direction - from Pantheon to your local, and from local to Pantheon. Doing frequent round-trips right now is a challenge. But with the symlink method detailed below, that process is easier. Also keep in mind that you only have to create the symlinks ONCE, for each site - preferably right at the beginning. I will add more notes later about going from Pantheon to LOCAL, step-by-step.

  1. Adding symlinks in DAMP for smooth import to Pantheon (ONLY NEEDED ONCE FOR EACH SITE)
    1. with your local DAMP site offline (or nobody working on it but you), MOVE the /sites/SITENAME.localhost/settings.php file and /sites/xxx.localhost/files folder to the /sites/default folder

    2. create symlinks from your settings.php file and "files" directories in default folder, and put the symlinks in xxx.localhost (this allows DAMP to see these files where they expect to see them in your local, but NOW you can have your Drupal File System configuration should point to /sites/default/files, and your theme logo and favicon settings can be the same - all this so when you import into Pantheon, you don't lose pointers to anything). You can use this nifty script to make symlinks VERY fast and easy (see bottom of page). Be sure to compile/save it as Run Only, with or without startup screen. Thanks to for the script.

    3. create a run-only Applescript APPLICATION from the following code at the end of this post:

    4. Drop the "files" folder onto the "symlink-maker.app" droplet

    5. Drop "settings.php" onto the "symlink-maker.app" droplet

    6. You're done!

  2. Site Import into Pantheon, from local DAMP site (must be done EACH time you Import a Site into Pantheon)
    1. open a Terminal window

    2. sudo su <password> ## easier if you're a sudoer instead of having to type "su" in front of several of the commands ##

    3. cp -R /Users/USERNAME/sites/SITENAME /tmp/    ## you cannot use ~Sites alias with cp, must use "real" path ##

    4. cd /tmp/SITENAME/sites/

    5. chmod 777 SITENAME.localhost

    6. rm -R SITENAME.localhost

    7. mysqldump -u USERNAME -pPASSWORD --single-transaction DBNAME > /tmp/SITENAME/database.sql (if this doesn't work - try phpmyadmin 

      phpmyadmin to get an UNCOMPRESSED export to a "database.sql" file.
    8. mv ~/path/to/downloads/database.sql /tmp/SITENAME

    9. cd /tmp

    10. tar cvzf SITENAME.tgz SITENAME

    11. mv SITENAME.tgz /Users/USERNAME/sites   (## same as #2 - mv won't allow ~Sites alias use)

    12. import site into pantheon dashboard https://getpantheon.com/sites/SITENAME.gotpantheon.com


Be sure to compile this code as standalone drag-and-drop (AppleScript's compiler will add the "/app" suffix if your script fulfills these requirements). Here is the droplet code for "symlink-maker.app":

on open (docpath)
  tell application "Finder"
    activate
    set docpath to docpath as text
    set search_string to ":"
    set replacement_string to "/"
    set oldDelims to AppleScript's text item delimiters
    set AppleScript's text item delimiters to the search_string
    set docpath to text items of docpath
    set AppleScript's text item delimiters to the replacement_string
    set docpath to text items of docpath as text
    set unixpath to "/Volumes/" & docpath
    set AppleScript's text item delimiters to the oldDelims
  end tell
  if last text item of (unixpath as text) is equal to "/" then
    set unixpath to (text 1 through ¬
     ((length of unixpath) - 1) of unixpath)
  end if
  do shell script "ln -s " & quoted form of unixpath & " " & ¬
   quoted form of unixpath & ".sym"
end open