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/