.command files can be double-clicked

From Chris Page on Stack Overflow: How do I make this file.sh executable via double click?:

By default, *.sh files are opened in a text editor (Xcode or TextEdit). To create a shell script that will execute in Terminal when you open it, name it with the “command” extension, e.g., file.command. By default, these are sent to Terminal, which will execute the file as a shell script.

You will also need to ensure the file is executable, e.g.:

chmod +x file.command

Works also for .tool files.

Combine this with Allow .command files to determine working directory - Mac OS X Hints (from ‘04) and you have a low-level interface to allow non-technical colleagues run command line scripts.

The command line is a great and powerful tool for any capable developer, but to most non-technical users and colleagues, it is an uncomforting, alien black box. Ideally, any set of directions meant for everybody on your team should never include “open up Terminal.” .command files provide a mechanism to bridge this gap.


In the couple years that dropshado.ws has been dropping shadows, this is one of my favorite finds.

  1. It’s way old.
  2. It’s a bridge between the command line and the GUI.

Re-enable Option+arrow move-by-word in Lion

Before you go whining like an impulsive brat about a reliable OS X feature that you believe has been sorely ripped out of Lion, rest assure that there’s probably a preference setting for it.

In my case, my beloved Opt+arrow move-by-word key bindings were not working after I upgraded to Lion. Turns out the default keyboard shortcuts for Mission Control were conflicting with them. Go to System Preferences » Keyboard » Keyboard Shortcuts and disable or change Mission Control: Move left/right a space.

Lion Keyboard Shortcuts Preferences

Sorry about that :P

Enabling PHP, Apache, & .htaccess in Mac OS X

I’m trying out developing without MAMP, and relying on the frameworks that are built into OS X. Here’s how I got Apache, PHP, and htaccess working:

Additionally, I changed the document root to point to my projects folder.

Within /etc/apache2/httdp.conf it can be changed in:

DocumentRoot "/Users/username/projects/"

And then in /etc/apache2/users/username.conf

<Directory "/Users/username/projects/">

Arrange icons by kind

My desktop gets messy. This cleans it up a bit, grouping items by filetype, folders first.

With the desktop focused: Finder › View › Arrange By › Kind. Or by key command ⌘⌃5

Arrange By Kind screenshot

Ctrl + Cmd + Shift + 3 / 4

Again, via Phil Dokas.

Hold Control with Cmd+Shift+3 or 4 and your screenshot will be copied to your clipboard without generating an image file on your Desktop. Paste right into Photoshop.

More Cmd + Shift + 4 hotness

Phil Dokas followed up with:

⌘⇧4, click + drag to make a selection without releasing, now hold down the spacebar and move the cursor.

If you instead hold down spacebar + shift, you lock one axis of movement.

Cmd + Shift + 4 / +Shift / +Option

After triggering screen capture with ⌘⇧4 (Cmd+Shift+4), you can use additional keys like in Photoshop. Holding down Shift (⇧) will keep lock one dimension, for changes to only the vertical or horizontal dimension. Holding down Option (⌥) will cause the overlay to be sized symmetrically.

Tested only OS X Snow Leopard. Not sure about earlier versions.

Keyboard navigation - Space vs. Enter

First off, you should have Full Keyboard Access enabled for All Controls in System Preferences > Keyboard > Keyboard Shortcuts. Now then…

shut down dialog

As a former Windows user, this dialog boxed perplexed me. I see two buttons that appear to be focused. Mind you, no mouse hover state is affecting these buttons. Restart appears to be focused, and Shut Down looks special. If I hit Enter, I would expect that Restart would be hit, but instead Shut Down is triggered.

My problem was that I was using Enter instead of Space. Hitting Enter triggers the default (special) button. Hitting Space triggers the focused button.

Twitter dialog

Now when faced with this dialog from the Twitter app, I can appropriately trigger the button I want without hitting Tab.

You can also use space to toggle checkboxes on forms. Hitting enter will submit the form.