Tag Archives: mac - Page 4

Subversion Global Ignores

If you’re a Mac OS X user running Subversion on the command line and mounting remote disks you may have run into instances where you want to globally ignore ._*, .AppleDouble, and *:2e_* files. To do this simply open your Terminal and edit your ~/.subversion/config file and look for the line below.

#global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store

Uncomment it by removing the # and add the necessary additional exclusions and it will now look like this.

global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store ._* .AppleDouble *:2e_*

Save it and you’re all set. Now you won’t need to edit your svn:ignore property for every project!

Delete Sends Ctrl-H

Delete Sends Ctrl-H in TerminalIf you’re a Mac user who utilizes Terminal.app with any regularity you have probably run into some Linux servers where the Mac Delete key behaves as forward delete instead of backspace (Ubuntu, Debian, and a few other distributions have this issue). This is a really obnoxious problem, but fortunately there is an easy global fix.

To repair the problem you’ll need to go to the Terminal.app preferences, select settings, then under the default theme you’re using click the advanced tab.  Now you can check the “Delete Sends Ctrl-H” option and close the prefs. Any existing windows will retain the old behavior but new tabs/windows will now behave as expected.

FileVault Performance With Lightroom

I have recently begun switching from Aperture to Lightroom for my photography workflow (look for another blog post about that at some point), but on my new unibody Macbook Pro I noticed that Lightroom appeared to be unbearably slow when dumping large volumes of data.  I suspected that FileVault (which I only keep enabled on my work laptop) was the culprit, so I decided to perform a few benchmarks.

Test Setup

The import was performed using a Sandisk Extreme USB 2.0 CF Reader with a Lexar 8GB UDMA card.  There were 113 21MP RAW files (beach photos from a 5D Mark II) on the card totaling 2.61GB of data.  Lightroom’s import was set to copy into the home directory and generate 1:1 previews after import.  I used a unibody MBP running at 2.4ghz, 250GB 5400RPM drive, and 2GB of RAM with two separate user accounts (FV on and FV off).

Results

FV Performance in Lightroom

As you can see, while generating 1:1 previews varies by less than 2%, the initial import takes nearly twice as long.  Additionally, during the import to a FileVault enabled home directory the machine is nearly unusable due to heavy disk I/O.  diskimage-helper hovers around 40-60% CPU during this time.

Of course, 321 seconds for a 2.61GB import is not particularly fast.  Let’s take a look at 4 transfers of the same data to see what types of speed we’re getting.

RAW Copy Performance

Import performance is essentially equal with FileVault both on and off when simply copying files via the Finder (~17MB/sec with this USB 2.0 reader).  So then, FileVault doesn’t affect Finder copy performance…why is it affecting Lightroom?

Digging Deeper

One of the side effects of FileVault’s method of home directory encryption is that any file on the hard drive outside of the encrypted home directory must be re-copied (rather than simply moved) if you wish to move it into home.  Using fseventer we can track where Lightroom is placing files during import, and it appears that significant quantities of data are being stored in /tmp and then copied into the home directory when the file is done.  This is a very expensive operation compared to a direct copy when FV is enabled.

Outstanding Questions

I’m still a bit baffled as to why Lightroom is so much slower on import vs a Finder copy even when FV is off.  A move operation is essentially free when compared to the expense of a full copy, so if Lightroom copies to /tmp and then moves why isn’t FV off nearly as fast as a direct copy?  Obviously LR has quite a few operations (minimal thumbnails, catalog updates, et cetera) to perform, but does that account for the twofold drop in data transfer speed?  Is there something else I’m missing?  I’ll revisit this issue with Aperture performance numbers and perhaps data points from an older Santa Rosa Macbook Pro.

Color Terminal in OS X

Apple ships OS X without ls set to use colors (and sans the useful ll alias). For those of us who have grown to love the instant delineation between directories, symlinks, and files this is an inconvenience. Luckily, adding this is quite simple. Place the following into your ~/.profile and you’re all set. To change this setting for all users edit /etc/bashrc as a superuser, but be aware that future OS X updates could potentially erase your modifications.

export CLICOLOR=1
alias ll='ls -l'

If you’d like to alter the ls defaults for coloration you can add one more line:

export LSCOLORS=ExFxCxDxBxegedabagacad

The incomprehensible value is a custom color setting defined by these rules.

For those who are new to the command line, ~/.profile means a file named “.profile” in your home directory. You can create the text file in TextEdit, save as plain text, then rename it to .profile, but be sure to move it into your home directory first as the Finder hides files prefixed with “.” by default.

Folder Actions in OS X

Awhile back I started getting annoyed at the process of manually moving files around after downloading, so I decided to investigate one of Apple’s more hidden features…Folder Actions! For those who don’t know, folder actions are configurable scripts that can be attached to folders and run whenever the contents of the folder change. They can do anything from copying mp3s you download from Amazon MP3 automatically into iTunes to converting documents automatically into PDF.

In a fit of boredom I have made a screencast showing how to make a simple folder action. If you’d like to follow along yourself, here is the applescript script (please note that you’ll need to create a folder named JPEGs in your ~/Downloads folder as well). Open Script Editor and paste it in to begin!

on adding folder items to my_folder after receiving the_files
tell application "Finder"
set jpgFolder to folder "JPEGs" in my_folder
repeat with f in the_files
if f's name ends with ".jpg" then
move f to jpgFolder
end if
end repeat
end tell
end adding folder items to

Obviously this represents a profoundly simple use case, but folder actions can have near limitless complexity. Unfortunately there are several issues with the implementation of this feature in OS X. Whenever the folder action actually triggers you will briefly get a flicker in your foreground window as the Finder takes focus, and for reasons I can’t quite nail down actions do not seem to trigger with 100% reliability. Despite these issues, this is a powerful tool that can be exploited in fascinating ways.