Mac OS X ‘open’ command

If you work with the command line often, you may find the open command useful.

open will launch the program associated with a file, as determined by LaunchServices. For example, to open all .c files in the current directory:

open *.c

It can also be used to open Finder to a particular directory. For example, to open Finder to the current directory:

open .

Using Mac OS X with Linux CUPS server

If you have a printer connected to a Linux box that is being shared via CUPS, the following command at the command line in Mac OS X will tell CUPS on your Mac to look for printers on other CUPS servers.

cupsctl BrowseProtocols='"cups dnssd"'

Now when you go to Printers in System Preferences, your shared Linux printer should show up automagically.

Windows 7 Printer Share with Mac OS X

Naturally, Windows 7 (Pro, at least) doesn’t play nicely on a Mac OS X network environment out of the box.  As far as I can tell, Windows 7 doesn’t utilize IPP, which Linux and Mac employ for printer sharing.

The situation: I wanted to print from my Mac laptop to my printer connected to Windows 7. To do this, I had to enable a feature disabled by default.

In Control Panel, have a look at Programs and Features. Then look under Turn Windows features on or off. Under Print and Document Services, check LPD Print Service to install and turn on this service, which will allow sharing your Windows 7 attached printer across your network.

Additionally, you need to specify to Windows the printer(s) you would like to share.  From the Start menu or Control Panel, select Devices and Printers. Right-click on the printer and select Printer Properties.  Under Sharing, select Share this printer and give it a share name without spaces.

On your Mac (the client), go to System Preferences then Print & Fax. Click the + to add a new printer. Under Advanced, set the Type as LPD/LPR printer. For the URL, enter lpd://ip_address/share_name/

For example, lpd://

You may try using your machine’s name instead, but I had better luck using my IP address. If your IP address is dynamic and changes, this would obviously cause a problem. Select the correct driver based on your printer model, and give it a go!

Duplicates in Mac OS X “Open with…” Finder menu

I’ve read several blogs and forums online describing how to fix the problem of duplicate or old entries in the “Open with…” contextual menu in Mac’s OS X Finder.  The problem with some of these sources is that the path listed is not always correct, rendering the ol’ copy-and-paste standby useless.  One easy way to handle this is with the locate command.

To rebuild the list of programs under the “Open with…” menu, from a Terminal shell, copy/type:

`locate lsregister` -kill -domain local -domain system -domain user

Note the ` [backward apostrophe] is the key shared with the ~ [tilde or “twiddle” in unixspeak].  This should not be run as the superuser, but rather as your own login.

This could potentially fail if you have more than one lsregister installed on your system, but that shouldn’t be the case with a default install.

You may need to logout and log back in for the changes to be seen.