Some files don’t have extensions. On the Mac, in the absence of other type metadata, the system will always open such files with the application for plain text documents. But sometime you might want to use a more specialized one. Here’s how you can use Magic Launch 1.0.1 (today’s update) to assign a different application to files with no extension, such as the commonly encountered “Makefile” and “.htaccess” files.
If not already done, you’ll need to download and install Magic Launch. To install, just double-click the preference pane you downloaded: this will open System Preferences and ask for your permission to install it.
On the left side of the Magic Launch preference pane you have a list of file types. You can add file types by typing their extension, but in this case you’ll need to select the file yourself, as it does not have an extension. The easiest way is to drag a file from the Finder to the list box on the left.
When you drag a “Makefile” file, or most files with no extension, the type “.txt .text” will be added and become selected. That’s because the operating system uses the same application for text files and files with no extension1.
On the right side you see the default application for the selected file type. If you change it there, it’ll apply to all files of this type. In our case, if you change the default application for “.txt .text” it will also apply to all files with no extension. That’s not exactly what we want however…
We want to change the default application only for files called “Makefile”. To that end, we add a rule. Click the “+” button below the list box on the right to make appear the rule editor.
Here we give a name to this rule, and select the application we want to open when it matches the file. Then, in the criteria editor below, opening the first pop-up menu on the second row reveals a list of options. Selecting “name” will allow you to complete the sentence with “is” “Makefile”:
We can now save the rule. It’ll match files named “Makefile” and open them in the specified application.
You should now be able to add another rule for files named “.htaccess” if you want. Note that “.htaccess” is a hidden file because it starts with a dot, so it might be hard to reach. Fortunately, there is a way to show hidden files in the Finder.
If you want to share your rule with a friend, drag it from the list box to your desktop, where it becomes a file. You can then drag it back to the Magic Launch preference pane on someone else’s computer.
Some applications attach a type code metadata to files to indicate their type even in the absence of an extension. So you may encounter files with no extension which aren’t part of the “.txt .text” file type. You can add such a type to Magic Launch and configure it separately if you wish.
Similarly, some files with the executable bit set will have the UTI
public.unix-executable. You can add rules and change the default application for those too: just drag a file to the type list to see its settings on the right. ↩