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 17.0.0.0/8 (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 mod_userdir.so, 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 mod_userdir.so 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/mod_authn_dbm.so
#LoadModule authn_anon_module libexec/apache2/mod_authn_anon.so
#LoadModule authn_dbd_module libexec/apache2/mod_authn_dbd.so
#LoadModule authn_default_module libexec/apache2/mod_authn_default.so
#LoadModule authz_groupfile_module libexec/apache2/mod_authz_groupfile.so
#LoadModule authz_user_module libexec/apache2/mod_authz_user.so
#LoadModule authz_dbm_module libexec/apache2/mod_authz_dbm.so
#LoadModule authz_owner_module libexec/apache2/mod_authz_owner.so
#LoadModule authz_default_module libexec/apache2/mod_authz_default.so
#LoadModule auth_basic_module libexec/apache2/mod_auth_basic.so
#LoadModule auth_digest_module libexec/apache2/mod_auth_digest.so
#LoadModule dbd_module libexec/apache2/mod_dbd.so
#LoadModule mime_magic_module libexec/apache2/mod_mime_magic.so
#LoadModule unique_id_module libexec/apache2/mod_unique_id.so
#LoadModule proxy_connect_module libexec/apache2/mod_proxy_connect.so
#LoadModule proxy_ftp_module libexec/apache2/mod_proxy_ftp.so
#LoadModule proxy_scgi_module libexec/apache2/mod_proxy_scgi.so
#LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so
#LoadModule dav_module libexec/apache2/mod_dav.so
#LoadModule dav_fs_module libexec/apache2/mod_dav_fs.so
#LoadModule bonjour_module libexec/apache2/mod_bonjour.so
#LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so

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 http://dev.mysql.com/downloads/, 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 http://macports.org.

Continue reading