If you find online backup solutions expensive and heavy on your system, you might be pleased to hear there is a cheap, easy way to create a mirror backup your Mac (or other UNIX variant) to a secure online server using a program named rsync. And as of Mac OS X Leopard, rsync will even transfer metadata associated with your files like tags and comments.
This method does not allow you to roll back to previous dated backups like certain backup solutions do (Time Machine, for example). What it does is create a mirrored backup of your Mac on a remote server, so it's best used in conjunction with a local hard drive-based incremental backup solution. Still, if the house burns down, your files will be safe and once you've done the initial backup, rsync is very efficient at keeping your remote backup mirrored with your disk.
In this example, we're going to backup the currently logged-in user's Documents folder.
This short how-to explains how to get HTTPS/SSL working on Leopard, which uses apache2. First, follow the steps in this hint, but instead of following Step 5, do the following:
Edit /private/etc/apache2/httpd.conf, and uncomment the following line (it's line 473 in my installation):
Include /private/etc/apache2/extra/httpd-ssl.conf
Edit /private/etc/apache2/extra/httpd-ssl.conf, and make sure that:
SSLCertificateFile points to newcert.pem
SSLCertificateKeyFile points to webserver.nopass.key
SSLCACertificateFile points to cacert.pem
SSLCARevocationPath points to demoCA/crl
Be sure to include the full pathnames for each entry. Optionally, you can edit DocumentRoot to your liking. I point it to /Library/WebServer/Documents-SSL, so I have two roots, one for http and one for https.
After these steps, restart apache2. Preferably do this from the command line (sudo apachectl graceful), so that you can see if the configuration is accepted or not. After that, point your browser to https://localhost/, and marvel at https beauty.
Recently after switching from Mac OS X to Debian, I found I needed to restore a couple files from the Time Machine backup that I kept. The drive works just fine as an HFS+ mount, but I couldn't figure out how to retrieve anything within. When Google didn't yield the answer, I began to explore on my own.
It turns out Apple does a couple slick things with the file system to make incremental backups work, including hard linking to directories, which isn't allowed in Linux. So for anyone that needs to access their Time Machine from something other than its associated Mac, here's how you do it...
[robg adds: The following details were reproduced (with minor editing) using the author's original blog post, with his permission.]
I recently upgraded to Leopard after getting my hands on a MacBook (goodbye G3 iBook!), and was unable to use X11 from my clean install. After trying to reinstall X11 from my install disc as suggested in this hint, I still couldn't use it. After looking at both the /System » Library » LaunchAgents » org.x.X11.plist, and the console errors...
...it became pretty obvious that the -launchd flag was the problem. So I backed up /System » Library » LaunchAgents » org.x.X11.plist, and then edited it with root privileges. In the ProgramArguments key, I removed this line:
<string>-launchd</string>
After saving the file and restarting the computer, X11 worked as expected.
[robg adds: I'm not sure why this fix was required -- my plist file contains the -launchd item, and X11 runs just fine. If anyone can shed some light on the problem, please leave a comment...]
Often I read the question "Where are all the icons on my Mac?" Here is the answer, in the form of a Perl script. Just copy and paste the below code into a new file, save it as something (findOSXicons) to a directory in your path, and make it executable (chmod 755 findOSXicons). Then use the usual techniques to start the script (i.e. calling it using the full or relative path). Here's the code:
One of my least-favorite error messages is the one that says a volume can't be ejected because it is in use. The vague advice to "try quitting applications" often leads me on a wild goose chase -- somehow it always seems to be the last application I try that has a document on the volume open.
I finally realized that the Unix lsof command is exactly what one needs in this situation. I have known about lsof for a long time, but somehow never put two and two together. Now when the Finder tells me I can't eject the volume 'DODO,' I just run this in the Terminal:
lsof | grep DODO
The output may then look something like this:
bash 228 johndoe cwd DIR 14,4 4096 2 /Volumes/DODO
Word 1379 johndoe 24u REG 14,4 81 197704 /Volumes/DODO/C/Archiver/test.txt
This shows me that Word has test.txt open, and that there is a shell whose working directory is on DODO. This makes clear exactly what I need to do to be able to eject the volume -- close the Word document and cd out of the directory on DODO.
[robg adds: This use of lsof is mentioned in the commends to a much older hint I wrote on ejecting a busy disk image using fstat. At some point in OS X's history, it seems fstat vanished (at least as an end-user program) -- I can't find it on either my 10.4 or 10.5 partition, except as a BSD system call in OS X 10.5 -- leaving the use of lsof as the preferred way of finding out what's keeping a disk image busy. Due to that change, I felt it worth running this hint as a standalone refresh of the original. If you have another method, please post it in the comments.]
[Note: This is a near-duplicate of this older hint -- thanks to hayne for pointing this out to me. However, given there's a good chain of comments here, I'm going to leave this hint up. Sorry for the duplication.]
This hint explains how to view an in-motion Doppler weather radar image from The Weather Channel on your desktop. A little precaution is in order, though: this will eat up quite a bit of CPU cycles (between 12% and 30% on an Intel Mac mini). I use it on a machine that does monitoring/notification, but I'd never use it on a machine I use for normal work. The "animation" is somewhat slow, but tolerable in my opinion. This hint requires use of the command line. Also, I make no guarantees that it won't break something, etc. I've only done this on Leopard, but I can't see any reason why it wouldn't work with Tiger (no Panther or earlier, because they don't have launchd).
There are two components to this: A unix script to retrieve the images from The Weather Channel or NOAA or wherever else, and a launchd agent that periodically runs the script.
Here's the shell script:
Edit the script to suit your location by retrieving the image URLs from weather.com or somewhere else. I've added the commands to reset the refresh interval and restart the dock, because in my experience, this stops working after a couple hours without doing so. Drop the script in the /Library/Scripts folder. Also make sure to make it executable with this command: sudo chmod 750 /Library/Scripts/get_weather_radar.sh
There's already one hint on this site about the many wonders of the Unix utility jot. However, I was bored and decided to come up with some fun jot applications. So after hours of tweaking and coding, I came up with a script that lets you pick between three different types of output:
Monkey typing random words.
Geeky-looking code spam.
Random English words from the dictionary.
Choose one, and your terminal window will then fill with all the randomness you could ever want; type Control-C to stop the program. Possible applications include looking busy at work, lorem ipsum for filler text, and generally feeling geeky.
My favorite is the code spam option. My best friend's fiancee took one look at my screen and said in an awed voice, "What is that?," in the same tone that one might say, "You built a nuclear reactor in your back yard!?" So I suppose all that time coding was worth it :). Read on for the script and a bit of detail on how it works.
If you use webmail, you know that as you reply to messages the quoting will often get messed up with line wrapping. I was looking for a simple solution to handle this, and all I found were programs that did this plus a lot more, and they were shareware. So I wrote a shell script that will do the rewrap, unwrap, increase the quote level, and decrease the quote level. It works by having a parameter passed to it in the following manner:
change_quote.sh increase -- this will rewrap the text on the clipboard and add an additional ">" to the beginning of each new line. The full usage is as follows:
change_quote.sh (increase|decrease|rewrap|unwrap)
The package contains five scripts: one that does all the work, and four others that simply call the script with the appropriate parameter. I put the collection in ~/Library/Scripts, and access it from the system-wide Scripts menu. It works for any text on the clipboard, and copies the resultant changes to the clipboard.
[robg adds: I have mirrored the scripts here on macosxhints.com. You can read a bit more about the scripts, and potentially find updated versions, in this post on the author's blog.]
This is a fairly specific hint, but it might help someone trying to achieve the same thing. The goal: To back up a FileVault-protected home directory to a UNIX server, keeping the backup encrypted, and without logging off. Time Machine isn't an option, as it doesn't play well with Filevault. A previous hint I submitted does half the job, but the backups are stored unencrypted, so anyone with access to the server can read them.
The solution is to use EncFS on the server. This ensures files are stored encrypted (the password is stored in a file on the client, safely inside the FileVault protected home directory). Only SSH access to the server is required, no special encrypted volume is used (so the encrypted backup can easily be backed up itself), and root access is only required to install EncFS and add the user to the correct group. Here's what you need to do:
Set up a user account on the server, and ensure you can log in from the client with SSH using a public key with no password.
On the server, install EncFS. You will need at least version 1.4.
On the server, ensure each user that will be backing up is a member of the "fuse" group, eg. usermod -a -G fuse mike
If you want to back up files with resource forks or extended attributes, make sure the client and server are both running rsync version 3.0 (version 2.6.3 is included in 10.5). This compiles easily for OS X -- just download, ./configure and make, then put the rsync binary somewhere in your path. Do the same on the server.
Once that's done, you need to prepare the server. The setup I've chosen is a folder, /mnt/backup, which will contain all the backups for each user. Each user will have a folder in there called .user@hostname (note the dot), which contains the encrypted backup. As with FileVault, the decrypted version of this can then be mounted at user@hostname.