Fix duplicate programs in Finder’s “Open With” list

Right Click, Open With... has lots of duplicates!

Right Click, Open With… has lots of duplicates!

Every once in awhile, Mac OS X seems to lose it’s way with regard to the apps it shows when you right click on a file, and choose “Open With.” For some reason, this is particularly pronounced in Mountain Lion (Apple’s buggiest OS to date).

Here’s how to fix the problem:

Continue reading

iMessage and push notifications not working on your wi-fi network?

Apple’s new iOS 5 includes a feature that allows text messages to be delivered directly to iOS devices, bypassing your carrier’s cellular network completely. It’s nice, insofar as it includes delivery confirmation messages. So, iPhones know when a message is being sent to another iPhone, and automatically uses this new service called iMessage.

The downside is that if you connect automatically to a wi-fi network that has blocked ports, you’ll find that iMessage text messages aren’t delivered. They often just pause midway through sending.

Also, you may find that other push notifications for other apps (like Facebook, Calendar, etc.) don’t get pushed to iPhones.

Not to worry, it’s an easy fix (so long as your network administrator is amenable to fully supporting iOS features like this!).

iMessage and push notifications works over the APNS (Apple Push Notification Service) channel. That is TCP Port 5223 outbound to (Apple). Your admin will know what to do with this information!

Change permissions on all files and/or all directories

I recently needed to change the permissions of all files inside a directory (only files but not folders), including subdirectories. From the command line in Mac OS X, I ran this command with success which changed all files recursively to 666 (rw-rw-rw-):

sudo find . -type f -exec chmod 666 {} \;

Likewise, to change only directories to 777 (rwxrwxrwx), I used:

sudo find . -type d -exec chmod 775 {} \;


Apache runs slow in Mac OS X Lion? Speed up Apache in 10.7!

Apache runs very slowly in Mac OS X 10.7.1 Lion. I checked out the /etc/apache2/httpd.conf file and noticed that Apple shipped Lion with every single module turned on, meaning Apache is chewing up a lot of memory and CPU cycles on modules that (typically) aren’t needed!

Here’s how to reclaim the speed of Snow Leopard in Mac OS X Lion’s Apache configuration:

First, make a backup of /etc/apache2/httpd.conf.

Next, edit /etc/apache2/httpd.conf in your favorite editor.

Search for LoadModule.

Then, comment out the modules that you don’t need by adding a hash character (#) at the beginning of the line. Be judicious in what you turn off. For example, I turned off, which then caused Apache to fail on startup.

Running httpd -t from the terminal showed that Apple’s default httpd.conf file is using the module, so I left it on (since it presumably supports using home directories for serving Sites).

For me, the modules I turned off are:

#LoadModule authn_dbm_module libexec/apache2/
#LoadModule authn_anon_module libexec/apache2/
#LoadModule authn_dbd_module libexec/apache2/
#LoadModule authn_default_module libexec/apache2/
#LoadModule authz_groupfile_module libexec/apache2/
#LoadModule authz_user_module libexec/apache2/
#LoadModule authz_dbm_module libexec/apache2/
#LoadModule authz_owner_module libexec/apache2/
#LoadModule authz_default_module libexec/apache2/
#LoadModule auth_basic_module libexec/apache2/
#LoadModule auth_digest_module libexec/apache2/
#LoadModule dbd_module libexec/apache2/
#LoadModule mime_magic_module libexec/apache2/
#LoadModule unique_id_module libexec/apache2/
#LoadModule proxy_connect_module libexec/apache2/
#LoadModule proxy_ftp_module libexec/apache2/
#LoadModule proxy_scgi_module libexec/apache2/
#LoadModule proxy_ajp_module libexec/apache2/
#LoadModule dav_module libexec/apache2/
#LoadModule dav_fs_module libexec/apache2/
#LoadModule bonjour_module libexec/apache2/
#LoadModule fastcgi_module libexec/apache2/

Mac OS X 10.7 Lion supports freetype natively; ships with hardened PHP

Good news out of Cupertino. Apple’s new operating system, Mac OS X 10.7 Lion ships with a newer version of PHP (5.3.6), which has been compiled with GD, freetype, tidy (libtidy), and lots of other goodness.

Additionally, Apple has chosen to compile PHP with Suhosin Patch 0.9.10, which purports to substantially harden PHP. From the Suhosin web site: “It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself.”

Continue reading

Add MySQL to terminal shell in Mac OS X

Mac OS X 10.6 snow leopard uses the bash shell by default. If you install MySQL from the disk image (dmg) from, you can make it easy to access the mysql binary from the command line by adding it to your bash path.

Here’s how:

Open terminal, and type:

echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile

This adds the default location of the MySQL binary to your shell environment.

Then, you need to force the system to reload your .bash_profile file. Again, from terminal, enter:

. ~/.bash_profile

You can check your environment variables by typing in terminal:


Now, to access MySQL from the command line, you only need enter: