I have this 2009's Mac Mini .. and ever since been using MacPorts. Then a friend suggested HomeBrew.
Seems pretty could, although I am not sure what difference it could bring since MacPorts already served the purpose (not entirely true, somehow you could have compilation breaks too).
10.5 uses Xcode 3.1.2. So I need to use 3.1.4. This could be done if I download the entire image (size around 900MB) and burn it to a DVD.
I need to register myself for an account with the status of Apple Developer and tick some checkboxes. Go here. When you successfully verified your email and click with authorization log in, you could see a search box. Insert Xcode and find 3.1.4.
And, I need to remove my MacPorts as well since it isn't suggested to have them co-exist.