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.
I've created a simple Perl script that splits a text file into 4KB parts to use within iPod Notes. Usage is pretty simple:
Copy and paste the script (macosxhints mirror) into a plain text file named makenotes.pl on your system. Remember to make the script executable (chmod 755 makenotes.pl).
Put the script and the text you want to split into a directory. For this example, assume the directory is named book and located in your user's home folder.
Open up a Terminal and go to that directory: cd ~/book
Run the script with the filename (or filenames) as arguments: ./makenotes.pl colourofmagic.txt
When run, the script will ask you to create a title for this book -- this title is used as a directory name and as a prefix for the parts. For instance, if I use the title colour_of_magic, the script will create a directory named colour_of_magic in the current directory, and put the parts into that folder, eg colour_of_magic_1.txt, colour_of_magic_2.txt, colour_of_magic/colour_of_magic_3.txt, etc.
If you do a lot of downloading via scp and occasionally find yourself restarting a download that failed due to a closed connection, here's an alias that can help. Add the following to your user's ~/.profile file to create a "resumable scp downloading command:
alias scpresume="rsync --partial --progress --rsh=ssh"
This command uses rsync, and sets options for resumable transfers (--partial), displaying a progress bar (--progress), and insures that the transfer will be made using secure shell (-rsh=ssh). To use the command, open a new shell after saving your modified .profile file, and then type scpresume in place of scp in your normal transfer command.
[robg adds: I added detail to the original hint submission, so I apologize if I got some of the details on the rsync options incorrect.]