How can I install git on a remote OS X Server - without Developer Tools?

We have an OS X server that is co-located; that is, we have access by SSH and via the Server Admin utilities, but not via Remote Desktop.

Several months later, I'd like to install git on the server. However, it appears that Developer Tools were never installed; make and gcc aren't there. So I can't build from source. Also, without remote desktop, I can mount a .dmg file, but I can't actually run the installer.

Can anyone suggest a strategy to either run the installer from the command line, or get the relevant developer tools installed (again, these are normally a .dmg) so I can build from source?


Solution 1:

Run man installer and scroll down to the examples section. It should be able to install any mpkg or pkg. You could even download the Developer Tools mpkg from Apple's website and run that via the installer command.

Note that the installer command will not reboot the system so you will need to do that yourself.