I worked in a school district for a few years where we had two break-ins that included thefts of Mac laptops. So I decided to create something that would help track laptops in the event they were stolen. This is of course free, one of its major advantages. It is also hosted by yourself, so it is easy to control. This has run on about 1,500 computers without causing any type of overload on machines or the network, and it does exactly what it is suppose to do. I now use it on all home and family computers because I trust it so well. I have used it for about a half a year and it works on Tiger and Leopard.
Note that this is software, so if the thief erases the hard drive on the computer, this will remove the phoning home capabilities. This does take some tinkering around, so it's fairly advanced. But the end result is very rewarding. This hint is broken up into the following sections -- be sure not to skip anything:
To back up a local UNIX serving box (ALIX1C motherboard with FreeBSD), I wrote a simple but efficient bash script to save all or part of it in a DMG image disk file. This backup should be used as often as required (launching with cron needs a password-free RSA login). This backup is a differential one, and an exact replication is done assuming the RSA user has sufficient privileges to do so.
Why save in a DMG?
To avoid my Mac managing another file system deep tree.
To simplify moving the backup.
I'm aware I'm losing Time Machine benefits with such a solution, but the script is very easy to modify to sync to a simple file system local folder. Personnaly, my DMG is placed on my Time Machine disk, to avoid filtering the Apple Backup system.
For security and convenience, I use ssh transfering protocol with a shared RSA key. If you do not know how to set this up, you should look at that kind of search. Both boxes (the remote and the Mac) need rsync binaries. On the Mac, you'll need a DMG that's as large as the remote system to back up to. Its name and its mounted name are supposed to be the same.
I needed ImageMagick -- especially as a Ruby GEM -- so I had to somehow get gem install rmagick working, as it didn't work out of the box: Leopard doesn't ship with ImageMagick.
If you've ever tried to install ImageMagick without Fink or MacPorts, you'll have a quite good chance to go completely nuts. Especially the interdependencies of libjpeg and ghostscript are insane. I also wanted to keep the install as small as possible, and therefore I decided against installing the whole ghostscript package (but you may do so if you like).
I created a set of commands that you can copy-and-paste into a shell script, which should install ImageMagick flawlessly on your Mac. Please notice that Mac OS X 10.5.4 (or higher), XCode 3.1 (or higher), and X11 is required. You'll find the shell commands on this page; just copy and paste to use.
Afterwards, sudo gem install rmagick works like a charm for me. Hope this helps!
[robg adds: I haven't tested this one. To use it, click the Download button next to the code, then open the downloaded file (using Firefox 3, the file was named Download on my machine) in your favorite pure text editor. Save the resulting file to somewhere on your Unix $PATH, and remember to make it executable (chmod 755 scriptname), and you should be good to go.]
The fish shell is a modern command-line shell that aims to be more discoverable and less beholden to tradition than other shells like bash and csh. Among its many unique features are on-the-fly syntax highlighting of the command line, as well as tab completion for everything under the sun with descriptions for each possible completion. Unfortunately, this shell does not ship with Mac OS X, so you'll need to do some work to install it.
First, download and install MacPorts. This will provide a Terminal command, port, that you can run to download packages. If you prefer a nice GUI for this, though, I recommend downloading and installing Porticus as well.
If you're using plain old port, type port install fish at the command line. If you're using Porticus (or another MacPorts GUI), search for "fish" in "All Packages" and click the Install toolbar icon.
Because fish requires several large libraries that probably aren't installed yet, and must therefore be downloaded and installed before fish can be used, the installation will take quite a while. Go grab a sandwich and come back in a half hour or so.
Once the install is complete, fish is installed. You can run it from Terminal right now by typing /opt/local/bin/fish, and play around with it for a while to get a feel for it. (Hint: you can change the prompt by redefining the fish_prompt function.)
If you decide you like fish better than bash, you'll probably want to set it as your default shell. The process for doing this is not quite as straightforward as it should be, and might qualify as a hint in its own right. You can change a user's shell by opening the Accounts preference pane and right-clicking on that user's name in the list on the left, then choosing "Advanced Options...". However, if you attempt to set your shell to /opt/local/bin/fish, you will get an error when you launch Terminal claiming that the administrator has set your shell to an illegal value! To get around this, you must also add the line /opt/local/bin/fish to the file /etc/shells, which Mac OS X consults to determine what constitutes a "legal" shell. You will need to enter your password to edit the file.
Recently I've been wanting a way to pass command-line arguments to GUI apps by default, in my case a -geometry parameter to Emacs.app to make it start up in something approximating full-screen mode. It turns out there's a very easy way to do this.
As many already know, what appear as applications on OS X are in fact directories, containing the actual executable in their Contents » MacOS subdirectory. To cause this executable to be run with specific arguments, simply rename the existing executable to something else (I've used something like appname-bin) and replace it with a shell script that exec`s the renamed binary with whatever arguments you please (followed by chmod 755 or similar to make the script executable). For example, my script for Emacs.app looks like this:
The $@ at the end may or may not really be necessary, but I put it in to be on the safe side -- the OS apparently passes a parameter starting with -psn that I'm guessing is the position at which to place the app's window (remembered from the last time it was run). Emacs doesn't recognize this parameter, but other apps probably do. And as I discovered after a bit of experimentation, you do need to use an absolute path to the binary. I've only tested this on Tiger, but I'd be surprised if it didn't also work on Leopard.
When I use GeekTool, my computer won't go to sleep because my hard drive keeps getting accessed. Since I don't want to let this tool go, I have devised an alternate way to get my Mac to sleep. This remedy uses Bernhard Baehr's SleepWatcher. Now, there has been a hint about using this utility in the past, but it doesn't address a key point: your computer falling asleep when you are using it.
If you are doing a lengthy activity that doesn't involve touching the keyboard or mouse (watching a movie, for instance), your computer should stay awake. SleepWatcher doesn't know that, so in the middle of your movie, your computer falls asleep. The easy way around this is to tell SleepWatcher to sleep only when your monitor is off.
If you're running a Unix command (inside Terminal or otherwise), and you want to quickly capture the standard output in an editable buffer (for examination or snipping), just add | open -tf after the command.
The output of the command will be placed into a new TextEdit buffer, stored in the /private/tmp folder. For example, to get the output of the command-line version of System Profiler into a text file, just type (in the Terminal window):
system_profiler | open -tf
You can then edit the document, and save it (use File » Save As to pick a save location). This method saves a step over using a redirect (>) and then opening the resulting file.
In doing an mdimport -A in Terminal, I noticed a particular attribute called com_apple_ats_font_invalid. Spotlight seems to set this attribute for files in a font folder (e.g. ~/Library/Fonts) that aren't valid font files. Try this is a Terminal window to see if you have any bad fonts:
$ mdfind "com_apple_ats_font_invalid == 1"
You can see this in action if you use the -live switch on the above command. Once the mdfind starts, in another Terminal window, create a bad font:
$ echo "bad font" > ~/Library/Fonts/badfont.ttf
You'll see that the query in the first window now shows one match; remove the file you just created (rm ~/Library/Fonts/badfont.ttf), and the query count will drop to zero. Press Control-C to end the mdfind in the other window.
I'm not sure if this is new for Leopard or whether Tiger has it as well.
The stock OS X date command ships with a useful -v command that allows date calculation. For example, to determine the last day of February, you could use the following:
date -v3m -v1d
That's the third month in the first -v, and then less one day in the second -v. man date gives many examples. On the other hand, the Gnu version of date that's available from MacPorts does not support this option. Playing a bit with the --date option for Gnu's date, I came up with:
date --date="march 1 1 day ago"
This results in the same date calculation as in the stock date function. Gnu's date also includes the option of printing rfc-2822 and rfc-3339 dates. The latter can be used for applications like Google that require xls dates:
The ns means nano-seconds.
Given the different features of the two programs, it might be useful to keep both on your system, with the Gnu version of date being stored as gdate.
Google searches for Sync iDisk largely show results that say something along the lines of "just edit the iDisk version." For me, iDisk is more about backup than anything else. I don't really have the need to share Documents with other people, and the local Documents folder of my laptop is always authoritative for my data. However, it would be nice to have a synced and restorable copy of my Documents "in the cloud" in the event my laptop fails. rsync works well for this.
My first step was to log into MobileMe, click the Account link, then to click on Storage Settings. Here I dropped my mail storage from 10Gb to 2Gb and ended up with an 18Gb iDisk, perfect for backing up my critical documents. Next, I wrote up a simple shell script to handle the rsync function and to copy the data from my local Documents folder to my iDisk's Documents folder.