"Portable" TextWrangler with Dropbox

May 17, '12 07:30:00AM

Contributed by: chrisgerke

I love TextWrangler, and I have a Mac at work and one at home, but often do coding on both. I set up a system using Dropbox so both my preferences and my Application Support files sync so I always have my stationery files and the same settings, wherever I am.

Run the following as a shell script on each of the Macs. This will copy TextWrangler to your Dropbox folder, and create the support folder on Dropbox, then create a symlink to it in the correct location on your Macs. It will then copy the preference files to Dropbox, so when you launch the application on either Mac, you'll have the same setup.

#!/bin/bash
#+ Portable TextWrangler

#* Formatted date & time string.
FORMATTED_DATE=`/bin/date "+%Y-%m-%d%H%M%S"`

#+ Remove it from /Applications (optional, just so you can replace it with a ln to your dropbox)
sudo /bin/mv -f /Applications/TextWrangler.app ~/.Trash/

#* Add a link in /Applications to your DropBox copy
sudo /bin/ln -Fs ~/DropBox/TextWrangler.app /Applications/TextWrangler.app

#* Archive existing folder
/bin/mv -f ~/Library/Application Support/TextWrangler{,.$FORMATTED_DATE}

#+ Create cloud app support folder
/bin/mkdir -p ~/DropBox/TextWrangler

#+ Link cloud app support folder to your local workstation (this contains your stationery, etc.)
sudo /bin/ln -Fs ~/DropBox/TextWrangler ~/Library/Application Support/TextWrangler

#+ Create cloud app support folder for your preferences
/bin/mkdir -p ~/DropBox/TextWrangler/Preferences

#* Placeholder so your prefs go to the cloud
/usr/bin/defaults write ~/DropBox/TextWrangler/Preferences/com.barebones.textwrangler Placeholder true

#* Link cloud pref to your local workstation
sudo /bin/ln -Fs ~/DropBox/TextWrangler/Preferences/com.barebones.textwrangler.plist ~/Library/Preferences/com.barebones.textwrangler.plist

exit 0
[kirkmc adds: Personally, I wouldn't do it this way. For example, I don't see why you would copy the application itself to Dropbox; you can just have a copy on each Mac. You also might not want to have the preferences the same on both Macs, if one is a desktop and the other a laptop. So all that leaves is the support folder, which is easy to symlink.

If you want to do this with BBEdit, it's much simpler. As explained on the Bare Bones web site, BBEdit will look for the support folder on your Dropbox folder.]

Comments (4)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20120514165843160