Skip to Content

Five Dropbox tips for Mac Unix nerds

Dropbox is already a very powerful utility for Mac OS X, but if you're knowledgable in Unix, you can make it even better. Here are five ways that you can use Unix to get more out of Dropbox.

1. I wanted to update my copy of the HTML processing tool Tidy today. I was happy to find instructions for building Tidy under Snow Leopard, but it also reminded me of another way that I've been using Dropbox for some time now.

If you compile and install Unix utilities on your own instead of using MacPorts, Fink or Rudix, you will most often be asked where you want to install these utilities to. Normally the answer is /usr/local/, and you would use ./configure –prefix=/usr/local. I became frustrated with installing programs to /usr/local/ because I use two or three different Macs, and I would inevitably find that I was trying to use a program on a computer where it wasn't installed. I'd have to find it, download it, configure it, compile it and install it before I could actually do whatever it was that I wanted to do.


That's when it occurred to me that instead of installing to /usr/local/, I could install to my $HOME/Dropbox/ and have the program "instantly" available on all of my computers. This has been as simple as using ./configure –prefix="$HOME/Dropbox/" and then doing make and make install as usual.

Now it's important to note that all of my Macs are running the same version of OS X (10.6). It is theoretically possible that you could compile software on Mac #1 that would then fail on Mac #2 because Mac #2 doesn't have the necessary library, etc. To me, this is actually an argument in favor of using Dropbox, so all those library files are available anywhere Dropbox is linked. In practice, I have been doing this for two years and have not had any problems with it. (Older versions of Dropbox would not sync the "execute" bit, but that hasn't been true for quite some time now.)

This is especially handy if you have one computer that has a faster processor, more RAM or a better internet connection than the others, because you can use that machine to actually build the program, then simply sync it to the others. For example, my iMac is on a "fastest possible" DSL connection, and it has a faster CPU and more RAM than my MacBook Pro (which is on a slower internet connection here at home). When I need to compile a program, I pause Dropbox on my MacBook Pro, ssh to the iMac, download the source (I download the source to /tmp/ unless there's a really good reason to keep it. Generally, by the time I want to build it again, there will be a new version of the source anyway), and then I compile it using:./configure –prefix="$HOME/Dropbox/" && make && make install.

After testing that everything works fine on the iMac, I resume Dropbox on the MacBook Pro, and all the files I need (and onlythe files I need) are downloaded.

This has required a few minor configuration changes. You either need to point a few environmental variables to $HOME/Dropbox/lib instead of $HOME/lib or just make soft links (ln -s), which is what I did.

2. Speaking of soft links, I also linked my .zshrc to Dropbox too, so all of my customizations, aliases, functions, etc. are available everywhere. (See also my article on mstmp, which mentions putting its configuration file in Dropbox.)

3. I put my iMac's crontab file on Dropbox and wrote a launchd agent that reloads it any time the file has changed (Download the plist here). Some people think crontab is the devil, but I still find it useful. If you're not a fan of crontab, though, you can use launchd instead.

4. I have a launchd agent that runs a script that saves my IP address to a file in my Dropbox (which, in turn, gets uploaded to Simplenote via Notational Velocity ALT, which lets me know where to ssh into if DynDNS and/or "Back to My Mac" fails to connect me). The script checks to see if the information has changed, so it's only uploaded when necessary.

5. Want to be able to use "vi" on your Simplenote files? Move your Notational Velocity folder to Dropbox. Note that if you use Notational Velocity on more than one computer, you need to be sure that only one of them points to Dropbox, or else you'll get a lot of file duplication. If you sync preferences via MobileMe, Notational Velocity's directory will be synced, so be careful. You could probably find some sort of cron script to sync Simplenote, but to me, there's no real reason not to use Notational Velocity for flawless Simplenote syncing.

Surely there are some command-line geeks out there who can come up with some more Dropbox tips. Leave us a note in the comments.



Categories

How-tos Odds and ends

Dropbox is already a very powerful utility for Mac OS X, but if you're knowledgable in Unix, you can make it even better. Here are five...
 

Add a Comment

*0 / 3000 Character Maximum Comment Moderation Enabled. Your comment will appear after it is cleared by an editor.

20 Comments

Filter by:
Srirama

Hello, I'm not really familiar with Unix, so please help me out. Is this workable for cross-platforming any type of executable scripts? If I write simple ones in Linux, can they execute in Mac, since they seem to use the same structure of commands (mostly)?

Also, Matt Schinckel's tip is awesome ("dotfiles"), I need to start doing that!

Oh, and don't know if this is allowed here, but if so, http://db.tt/mqYbtei is my referral link. Please, we could all use the extra space. (If this isn't allowed here, I'm sorry, you can take that part of the comment down.)

February 17 2011 at 10:38 AM Report abuse rate up rate down Reply
2 replies to Srirama's comment
TJ Luoma


Shell scripts should be mostly portable, although some features or some commands may be different or might not work at all.

Mac OS X is more closely related to FreeBSD than Linux, but depending on what the script is or does, they will probably still work.

February 17 2011 at 10:49 AM Report abuse rate up rate down Reply
Srirama

Hmm... That's what I thought, thanks!

Some did work, like routine purging of a folder's contents. But, hey, I'm just starting out ;)

February 17 2011 at 11:29 AM Report abuse rate up rate down Reply
tricon

Great piece, TJ. We need more articles like this!

December 17 2010 at 9:28 AM Report abuse rate up rate down Reply
Michael Kingery

i just saw camera sync linked the other day - it is an iphone app that will sync all of your photos to dropbox in the background - it is completely awesome

December 15 2010 at 4:51 PM Report abuse rate up rate down Reply
Matt Schinckel

I have a folder in my dropbox called '.dotfiles'. Note the leading dot: that means it does not appear in the Finder.

Inside this, I have the files that I like to have on every machine: .bashrc, .gitconfig, .gitignore, .hgrc, .pdbrc, .pythonrc.py, etc.

I also have a script that will create the links on a machine. When I first start using a machine, I install DropBox, and then run the script. Then, I have the same bash/git/python etc environment on each machine.

Bonus: this also works with unix machines.

I also have a couple of folders: .python contains pure python modules that I want everywhere, and ~/.python is added to my PYTHONPATH. .bash_completion.d has a few custom bash completion scripts I have written.

December 15 2010 at 5:23 AM Report abuse rate up rate down Reply
jim

These hints are all fine, but what if Dropbox goes down or out of business? Remember to have a backup plan.

December 14 2010 at 8:18 PM Report abuse rate up rate down Reply
1 reply to jim's comment
Matt Schinckel

Have you ever used DropBox, jim?

It makes a _copy_ of your files on every machine. If DropBox goes away, all you lose is the syncing: your files are still there on all of your computers.

December 15 2010 at 5:18 AM Report abuse rate up rate down Reply
Kris

If you're a vim user:

vim -x ~/Dropbox/Passwords.txt

...will set up a strongly-encrypted password file that's available everwhere through Dropbox. After the first write you can drop the -x flag and just edit it normally.

December 14 2010 at 3:34 PM Report abuse rate up rate down Reply
applewax

I use Dropbox to keep AddressBook synced between my two Macs. Works great. To do it:

First, move your Address book data to your Dropbox folder. You can find your Address Book "data" folder in:

Your Home folder --> Library --> Application Support --> AddressBook

Make sure Address book is not running, then drag the AddressBook folder from your Application Support folder to your Dropbox folder.

Now open up terminal. (Applications --> Utilities)

In terminal, navigate to your home folder --> Library --> Application Support, like so:

cd ~/Library/Application Support/

Now create a symbolic link between the AddressBook folder in your Dropbox to your Application Support folder. To do this, type the following command:

ln -s ~/Dropbox/AddressBook/ ./AddressBook

Once you have finished this step, go back to the Finder to:
Home Folder --> Library --> Application Support

and verify that the symbolic link is there. Repeat on your other Mac computers.

December 14 2010 at 1:35 PM Report abuse rate up rate down Reply
2 replies to applewax's comment
mxfx

How about just setting up a Yahoo! or Google account for Address Book synchronization? If you're running 10.5 or 10.6, it's super simple.

December 14 2010 at 2:47 PM Report abuse rate up rate down Reply
Esben

That's the best tip I've recieved in ages! Have long been searching for proper way to sync contacts without MobileMe. This seems to work perfectly. For the record: I tried using Google Contacts, but the syncing messed up horribly when combined with my phone sync. Especially when it comes to contact pictures.

December 15 2010 at 7:39 AM Report abuse rate up rate down Reply
John

great write-up,, I've been using DropBox for my unix commands for quite some time now across 5 Macs.. quite useful indeed

December 14 2010 at 12:32 PM Report abuse rate up rate down Reply
Swanney

is it possible to use dropbox as your timemachine back up drive? I only have a macbook air so the dropbox has anough space for it all....

also is it possible to use drop box as your itunes folder for things like apps etc

also i have heard it is a good place to store your iphoto folder, and that is syncs just like it would if the iphoto file was on your mac still, is this true?

thank you for your help :-)

December 14 2010 at 10:48 AM Report abuse rate up rate down Reply
1 reply to Swanney's comment
Randy

WRT "also is it possible to use drop box as your itunes folder for things like apps etc"

Yes. I do this. Although I wish I had more space. (currently 3.5GB) but it's enough for my needs.

December 14 2010 at 10:57 AM Report abuse rate up rate down Reply
hans

1 and 3 are horrible hinds as these things should be machine specific unless compiled and setup specifically for cross computer use, which will rarely if ever be the case with 3.

December 14 2010 at 10:08 AM Report abuse rate up rate down Reply
4 replies to hans's comment
Buy an ad here

Tweets

© 2012 AOL Inc. All Rights Reserved.