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.
Share
Source: http://tuaw.com/tag/dropbox
Categories
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
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.)
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.
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 ;)
Great piece, TJ. We need more articles like this!
December 17 2010 at 9:28 AM Report abuse Permalink rate up rate down Replyi 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 Permalink rate up rate down ReplyI 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.
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 Permalink rate up rate down ReplyHave 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.
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.
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.
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 Permalink rate up rate down ReplyThat'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 Permalink rate up rate down Replygreat 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 Permalink rate up rate down Replyis 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 :-)
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.
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 Permalink rate up rate down ReplyDeals of the Day
more deals- Used Apple iPad 32GB Wi-Fi Tablet for $200 + free shipping
- Apple iPod nano Multi-Touch 8GB MP3 Player for $100 + $8 s&h
- Cases for New iPad at HandHeldItems: Extra 20% off, $2 credit, from $3 + $3 s&h
- $15 Apple iTunes Gift Card for $8 for new Saveology customers
- Retro 80's Case for iPhone for $11 + $2 s&h
- HHI 360 Dual-View Stand Case for new iPad w/ $2 credit for $12 + $3 s&h
20 Comments