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-):

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


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:

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:

You can check your environment variables by typing in terminal:

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

Install memcache and APC on Mac OS X Server (snow leopard 10.6, Lion 10.7, Mountain Lion 10.8)

Looking to speed up your SocialEngine, Drupal, or other PHP/MySQL web site? The combination of APC and Memcache can really speed up sites based on these platforms. If you’re an admin of a server running Mac OS X Server (10.6), here’s how to install APC and memcache on Mac OS X server:

Download and install MacPorts from

Continue reading

Clear DNS cache on Mac OS X

Changing domains around on your web server can leave you with a local DNS cache that doesn’t match your domain’s new settings. Flush your DNS cache on Mac OS X 10.5 by issuing the following command:

Edit 5/19/2014: OS X Mavericks has a slightly different method for clearing the DNS cache.