Raam Dev’s Weblog

Avatar

If you find something you really enjoy doing, do it, regardless of what others’ expectations of you are.

HOWTO: Disable OS X Window Drop Shadow for Screenshots

One of the awesome features of OS X is the built-in screenshot mode. It allows you to easily select areas of the screen to capture (press Cmd+Shift+4 to activate screenshot mode), or select an entire window to capture (while in screenshot mode, press the spacebar to switch to window-capture mode).

I frequently post screenshots on this blog and I hated that the window screenshots included the drop shadow added by OS X around the window. This meant the width of the resulting screenshot was actually 50px bigger all the way around.

Luckily, there is a way to disable the drop shadow when taking screenshots. Simply open the terminal (Applications -> Utilities -> Terminal.app) and run the following command:

defaults write com.apple.screencapture disable-shadow -bool true

Now logout (or reboot) and when you login again your screenshots won’t include the drop shadow! For more helpful shortcuts and commands for screenshots in OS X, check out Taking Screenshots in Mac OS X.

Evil Google Secretly Installs Software Update

I was shocked to see this Google Software Update window on my Mac this morning asking me to install an update to the Google Talk Plugin:

Google Software Update

First of all, I had never seen this update window in my life and I never approved the installation of any such Software Update Engine! Secondly, what Google Talk Plugin is it talking about? As far as I can remember, I never installed a GTalk plugin. I use Adium for chatting on GTalk and I never had to install a plugin to use Google Talk! Maybe the update engine is trying to update the GTalk plugin that came with Adium?

There are some other people who are also quite annoyed by this secret update engine installation. Apparently the update engine is fully open-source, but there is no uninstall program. To uninstall it, you must unregister applications that are using it and wait a day for it to automatically uninstall itself. How ugly.

HOWTO: Make iTunes Read Ogg Files

After downloading the only available torrent of Hang Drum music I could find, I was shocked to discover that iTunes wouldn’t read the Ogg files it contained. I was so close to losing a ton of respect for Apple until I searched Google for a solution. Hoorah for the xiph.org open-source community!

Simply visit their site and download QuickTime Components binary package. After opening the .dmg file (Windows users should be able to just download and run the .exe file), copy XiphQT.component to ~/Library/Components (user-only) or to /Library/Components (system-wide).

If iTunes is open, restart it and wallah! You’ve got .ogg support in iTunes!

Mounting HFS+ with Write Access in Debian

When I decided to reformat and install my Mac Mini with the latest testing version of Debian (lenny, at the time of this writing) I discovered that I couldn’t mount my HFS+ OS X backup drive with write access:

erin:/# mount -t hfsplus /dev/sda /osx-backup
[ 630.769804] hfs: write access to a journaled filesystem is not supported, use the force option at your own risk, mounting read-only.

This warning puzzled me because I was able to mount fine before the reinstall and, since the external drive is to be used as the bootable backup for my MBP, anything with “at your own risk” was unacceptable.

I had already erased my previous Linux installation so I had no way of checking what might have previously given me write access to the HFS+ drive. A quick apt-cache search hfs revealed a bunch of packages related to the HFS filesystem. I installed the two that looked relevant to what I was trying to do:

hfsplus - Tools to access HFS+ formatted volumes
hfsutils - Tools for reading and writing Macintosh volumes

No dice. I still couldn’t get write access without that warning. I tried loading the hfsplus module and then adding it to /etc/modules to see if that would make a difference. As I expected, it didn’t. I was almost ready to give up but there was another HFS package in the list that, even though it seemed unrelated to what was trying to do, seemed worth a shot:

hfsprogs - mkfs and fsck for HFS and HFS+ file systems

It worked! I have no idea how or why (and I’m not interested enough to figure it out), but after installing the hfsprogs package I was able to mount my HFS+ partition with write access.

  • Sun Microsystems has added PHP support to their open-source Netbeans development IDE. I just tried the latest version (6.5) and I’m not impressed at all, at least with their OS X version: It’s slow and the Open File dialog takes a good 45 seconds (!) to load. (0)

Creating a Bootable OS X Backup on Linux: Impossible?

I’ve had plans for a while now to set up a backup system using a Debian Linux server and rsync to back up my MacBook Pro laptop. At first glance, it seemed like it would be pretty straight forward. I’ve been able to make a bootable copy of my entire MBP using nothing but rsync (thanks to some very helpful directions by Mike Bombich, the creator of the popular, and free, Carbon Copy Cloner software). And by bootable copy I mean I could literally plug in the USB drive and boot my MBP from the drive (hold down the Alt/Option key while booting). Restoring a backup is as simple as running the rsync command again, but in the reverse direction. I know this solution works because I used it when I upgraded to a 320GB hard drive.

To start, I needed to create a big enough partition on the external USB drive using Disk Utility (formatted with Mac OS Extended (Journaled)). I then made a bootable copy of my MBP with one rsync command:

sudo rsync -aNHAXx --protect-args --fileflags --force-change \
--rsync-path="/usr/local/bin/rsync" / /Volumes/OSXBackup

But my dream backup system was more unattended. I wanted something that would periodically (a couple times a day) run that rsync command over SSH (in the background) and magically keep an up-to-date bootable copy of my MBP on a remote server.

I love Linux and I jump at any opportunity to use it for something new, especially in a heterogeneous network environment. So when I decided to set up a backup server, I naturally wanted to make use my existing Debian Linux machine (which just so happens to be running on an older G4 Mac Mini).

So, after making a bootable copy of my MBP using the local method mentioned above, I plugged the drive into my Linux machine, created a mount point (/osx-backup), and added an entry to /etc/fstab to make sure it was mounted on boot (note the filesystem type is hfsplus):

/dev/sda /osx-backup hfsplus rw,user,auto 0 0

All that’s left to do now is to run the same rsync command as earlier but this time specifying the remote path in the destination (root@myserver.example.com:/osx-backup/). This causes rsync to tunnel through SSH and run the sync. Unfortunately, this is where things started to fall apart.

OS X uses certain file metadata which must be copied for the backup to be complete (again, we’re talking about a true bootable copy that looks no different than the original). Several of the flags used in the rsync command above are required to maintain this metadata and unfortunately Linux doesn’t support all the necessary system calls to set this data. In particular, here are the necessary flags that don’t work when rsyncing an OS X partition to Linux:

-X (rsync: rsync_xal_set: lsetxattr() failed: Operation not supported (95))
-A (recv_acl_access: value out of range: 8000)
–fileflags (on remote machine: –fileflags: unknown option)
–force-change (on remote machine: –force-change: unknown option)
-N (on remote machine: -svlHogDtNpXrxe.iL: unknown option)

According to the man page for rsync on my MBP, the -N flag is used to preserve create times (crtimes) and the --fileflags option requires chflags system call. When I compiled the newer rsync 3.0.3 on my MBP, I had to apply two patches to the source that were relevant to preserving Mac OS X metadata:

patch -p1 <patches/fileflags.diff
patch -p1 <patches/crtimes.diff

I thought that maybe if I downloaded the source to my Linux server, applied those same patches, and then recompiled rsync, that it would be able to use those options. Unfortunately, those patches require system-level function calls (such as chflags) that simply don’t exist in Linux (the patched source wouldn’t even compile).

So I tried removing all unsupported flags even though I knew lots of OS X metadata would be lost. After the sync finished, I tried booting from the backup drive to see if everything worked. It booted into OS X, but when I logged into my account lots of configuration was gone and several things didn’t work. My Dock and Desktop were both reset and accessing my Documents directory gave me a “permission denied” error. Obviously that metadata is necessary for a viable bootable backup.

So, where to from here? Well, I obviously cannot use Linux to create a bootable backup of my OS X machine using rsync. I read of other possibilities (like mounting my Linux drive as an NFS share on the Mac and then using rsync on the Mac to sync to the NFS share) but they seemed like a lot more work than I was looking for. I liked the rsync solution because it could easily be tunneled over SSH (secure) and it was simple (one command). I can still use the rsync solution, but the backup server will need to be OS X. I’ll be setting that up soon, so look for another post with those details.

HOWTO: Install md5sum & sha1sum on Mac OS X

I was a bit surprised to learn that my Mac didn’t have the md5sum and sha1sum tools installed by default. A quick search and I found a site that provides the source. The sources compiled successfully on my Mac (OS X 10.5.5, xCode tools installed).

The only quirk appears in the last step:

$ ./configure
$ make
$ sudo make install
cp md5sum sha1sum ripemd160sum /usr/local/bin
chown bin:bin /usr/local/bin/md5sum /usr/local/bin/sha1sum \
/usr/local/bin/ripemd160sum
chown: bin: Invalid argument
make: *** [install] Error 1

The make install command tries to change the ownership of the files to the bin user. Since that user doesn’t exist on my system, the command fails. This isn’t a problem though, as both binaries work perfectly. By default, they are installed to /usr/local/bin/.

Accessing the VMWare Fusion BIOS

As noted in the Known Issues section of the VMWare Fusion Release Notes, the VMWare Fusion BIOS goes by way too fast to give you a chance to access it. The only way you can access it is by modifying the .vmx configuration file for the VM:

The VMware Fusion BIOS posts too quickly to access.

Most users will not need to access the BIOS, but advanced users might want to do so, to change the boot order, set a boot password, or enable a second floppy drive. To work around this problem, use a text editor to add the following line to the configuration (.vmx) file of the virtual machine:

bios.forceSetupOnce = "TRUE"

The next time you boot up the virtual machine, it will automatically boot into the BIOS. This configuration option then reverts to FALSE. You must set the option to TRUE each time you want to boot the virtual machine into the BIOS.

  • I haven’t tried it yet, but Backup-Bouncer looks like a very useful tool for verifying backup methods (it doesn’t actually verify backups, but rather the accuracy of a backup method’s ability to copy OS X metadata). The latest version of rsync (v3.0.3) passes Backup-Bouncer with flying colors when tested with this command: sudo rsync -aNHAXx –protect-args –fileflags –force-change /Volumes/Src/* /Volumes/Dst/test (0)
  • I just upgraded rsync on my Mac from v2.6.9 to v3.0.3 by following these directions. The ./configure command failed until I downloaded and installed the latest Xcode Developer Tools from Apple. The latest version of rsync is supposed to be faster for large transfers (such as backing up my entire 320gb MBP hard drive!). (0)
  • Last night I discovered I had been using an old version of rsync that did not use SSH by default! Something happened during my upgrade to Leopard that switched the default rsync from /usr/bin/rsync (v2.6.9) to an old version that must have been installed by fink in /sw/bin/rsync (v2.5.5)! I discovered the problem after a simple rsync command failed and I ran the command again with the -vv flags (to get a more verbose output). Sure enough, it was running with RSH and not SSH! Even the man page said RSH was the default! (On the upside, the suddenly broken PHP script I had written to help with deploying web projects, and which utilizes rsync over SSH, is not really broken after all.) (0)

HOWTO: Create an ISO Image from a CD in Mac OS X

Insert the CD you want to create an ISO image from into your CDROM/DVD drive and then launch Disk Utility (Applications -> Utilities -> Disk Utility). Select the CD underneath the drive listed on the left and then click New Image in the tool bar at the top.

Disk Utility

On the Save As dialog, enter a name for your ISO image and choose the location where you want to save the file. Change the Image Format from compressed to DVD/CD master (compressed will save the file as a DMG image). In the example below, I use example as the filename.

Disk Utility Save As Dialog

Disk Utility will create the disk image with the .cdr extension, even though the image itself is identical to a .iso image1.

Disk Utility Creating Disk Image

When Disk Utility is finished, you can browse to the file with Finder and rename the file from example.cdr to example.iso.

Rename CDR to ISO

The ISO image can then be distributed and burned on any system (I tested this by burning the resulting ISO on a Windows XP machine using the free DeepBurner application).

Not a true ISO image?

I have read that the resulting ISO image is not a “true” ISO-9660 filesystem and that you can use the following command to convert DMG images (leave the Image Format as compressed to create a DMG image in Disk Utility) into *real* ISO images using the following command:

hdiutil makehybrid -o example example.dmg

This will convert example.dmg into example.iso. However, after burning the resulting ISO image on a Windows machine the CD was not bootable. Using the renaming method I described above, the CD was bootable and Windows was able to see the contents of the CD without any problems.

I looked over the man page for hdiutil and even tried some of the examples to convert a DMG to a *true* ISO file:

hdiutil makehybrid -o example.iso example.dmg -iso -joliet

But after burning the resulting ISO to a CD, I discovered the CD was again not bootable. Maybe I’m missing something and someone can enlighten me. Until then, I will continue creating a .cdr image and renaming it to .iso.

Could this be the future of touchpads?

Future MacBook Pro Touchpad?

A multi-touch color screen touchpad using the same touchscreen as the iPhone? It could replace the OS X dock and provide a whole new method of interacting with your computer! Fingerprint security device, electronic signature pad, an electronic sketch pad for better photo editing accuracy… the possibilities are endless!

iCal Missing AM/PM Option? Change to 24-hour Mode!

Am I crazy or is there no way to make iCal show AM/PM when editing a calendar entry?

iCal Missing AM/PM Option

The AM/PM option IS there, because if I use the arrow key to move over to next field, there’s a hidden AM/PM field which I can change. However, unless I know what it’s already set to, I have no way of knowing what I’m changing it to. Very annoying.

My fix for this is to simply use 24-hour mode, which I already use on my main system clock anyway. Unfortunately, enabling the “Use a 24-hour clock” option in the Date & Time settings does not enable 24-hour clock mode in iCal. To do this, you must modify the International settings (!?).

System Preferences -> International -> Formats -> Times -> Customize

Changing time format

From here, you can select and delete the AM/PM option from the white field and then click the little arrow on the hour field to change it’s format to 24-hour (this screen is very non-intuitive for something made by Apple). I made the changes to Short, Medium, Long, and Full time formats and then clicked OK and WHAM! iCal showed 24-hour time and made it possible to easily change the time on an entry.

iCal 24-hour format

Unable to connect using Sprint U727 on Leopard - FIXED

After so many hours trying to fix the damn U727 USB Sprint card, I finally have it working again. It was working fine up until about a week ago when it mysteriously stopped working. I was getting all kinds of messages, including “Unable to connect” and several seemingly useless messages in /var/log/ppp.log: “Connect script failed”, “LCP: timeout sending Config-Requests”, “CCLExit: -6021 (No carrier.)”, and “CCLExit: -6019 (Modem error, modem not responding.)”.

I finally came across this post that included a list of steps which billio discovered fixed the problem for him. I am re-posting his steps here (I hope he doesn’t mind):

1. Remove the Novatel USB device.

2. Download the latest driver package for Mac OS X from Sprint. It says it is for Tiger (10.4) but it seems to work.

3. Delete (sudo rm -rf) all the Novatel files from /System/Library/Extentions. Reboot.

4. Run the mpkg installer for the Sprint drivers.

5. Reboot.

6. Open Network Preferences; plug in the Novatel device; click “+” and add “Novatel CDMA” device.

7. Click “Advanced” button. Change vendor to Novatel and Model to CDMA.

8. Click “Connect” and it works.

And I couldn’t believe it, but that actually worked! (I’m writing this post using the Sprint card right now.) You can find the Sprint drivers here (select MAC OS from the drop down and download the Sprint SmartView software).