Install macports on Snow Leopard

#1.  Make sure you have Xcode installed.  You can download it from here but you must have an account with Mac Dev Center

#2. Open Terminal (under Utilities in Applications folder)

#3. Checkout the software from the macports repository: svn co (Wait for it to finish checking out all files)

#4 cd base

#5 ./configure

#6 make

#7 sudo make install

#8 add /opt/local/bin and /opt/local/sbin to your PATH environment variable in .bash_profile

#9 sudo port -v selfupdate


Leopard sed replace regular expression

I recently had to replace an IP address in 150+ files with the literal *.  In order to accomplish this I used the following command:

sed -i.bak -e “/*:80/” *

This replaced the with *:80 for my virtual host files.

Leopard Apache won’t start after reboot

I took the following from this google posting:–Issue-Comment-Edited:-(MAGNOLIA-1959)-Leopard-(osx-10.5)-issues-td21853819.html

Just following up my previous posts and the solution we found to work with the ‘Too Many Open Files’ error, maybe it will help others as well.

The problem seems to be in the way Apple has changed the files/proc settings for Leopard. Using the ‘ulimit’ and ‘sysctl’ options to adjust the settings no longer works.

The option you have to use is the ‘launchctl limit’ command, which also adjusts both the ‘ulimit’ and the ‘sysctl’ settings automatically.

To check your existing settings, you can use the command ‘launchctl limit’, this shows that the server is ridiculously set at a very low maxfiles of 256 files per user/process.

Three columns will be returned, the first column displayed will be the name of the limit setting, you are looking for the ‘maxproc’ and/or ‘maxfiles‘ settings towards the bottom of the list.

To increase the maxfiles you can use the command ‘launchctl limit maxfiles user max system max’, where user max is the maximum files you want to allow for each user/process and likewise for system max.

An example would be (running as super user): launchctl limit maxfiles 2048 unlimited

We first increased this to 2048 unlimited as Apple states in the manual that the Server Admin app is supposed to change the soft process limit from 100 (the default) to 2048 when starting Apache, obviously this is not happening and the default is set to 256, so the manual is out of date or wrong. We did however still find infrequent ‘too many open files’ errors in apache logs so again increased the limit, this time to 4096 unlimited and have not had a problem since.

The same applies to the maxproc setting if you need additional processes.

You can verify the changes by using the ‘ulimit -a’ and/or ‘sysctl -a | grep files’ commands.

To make the changes stick through a restart, you need to add a file (as it doesn’t exist) by using something like ‘sudo pico /etc/launchd.conf’ and add the changes one per line, so in our case, our file looks like this:

limit maxfiles 4096 unlimited

Remember you do not need to add ‘launchctl’ in front of the commands in this file.

Hope this helps others with this problem, we have not upgraded to 10.5.3 yet, now that things are working in 10.5.2 we will have to setup a test environment before applying anymore potential fuel to the fire!

So I increased the maxfiles to 4096 (launchctl limit maxfiles 4096 unlimited) and the maxproc to 2048 (launchctl limit maxproc 2048 unlimited).

After this two instances are starting fine.

Enable RAID Leopard boot disk without a reinstall of OS

Instructions were taken from here:

The “enableRAID” command to change an existing active volume into a RAID slice doesn’t always work (diskutil sometimes refuses to do this). Here’s a safer and surer way to turn your boot disk into a RAID group with minimal down time and without installing OS X on the new disk.

The basic idea is to turn the new disk into an empty RAID slice (this seems to always work) and then copy the boot disk onto it. Boot up into this one-disk RAID group, and then turn the original boot disk into the second RAID slice. This is safe because you’ve already successfully booted into the copy before you overwrite the original. In more detail:

1) I started by using Disk Utility to erase the new drive I was adding. (Or OS X may offer to do this for you when you first plug the drive in). Make sure the format of the drive is OS Extended (Journaled). I named the new drive “BootRAID”. I then quit Disk Utility and from a terminal window ran “diskutil enableRAID mirror /Volumes/BootRAID” NOTE: The name of the drive is NOT relevant, as it can be changed when the process is compete.

2) I then restarted Disk Utility, clicked on the new drive and used the Restore option to copy the boot disk onto “BootRAID”. Note that the new drive has two entries in the list of volumes (slice name and RAID group name) and only one of these has the Restore option.

3) When the copy was complete I selected “BootRAID” as my boot disk in System Preferences and rebooted. This reboot was the only downtime.

4) Now I was booted into the one-disk (degraded) RAID group and I again used the graphical Disk Utility and dragged the old boot disk into the RAID
group. This erased the old boot disk and started the mirror “repair”.

NOTE: If you have issues just dragging and dropping the disk into the RAID group, you may need to erase the drive first!!

The repair copied the mirror disk onto the original disk, and a few hours later I had an intact mirrored RAID group as my boot disk.