Mac OS X - installing software via DMG vs. *nix command line style

4

3

New Mac owner here, but long time Linux user. Can anyone describe to me the differences between installing a piece of software, such as Subversion, from a .dmg image as opposed to compiling and installing from source on the command line? Does the software end up in the same location? What other differences exist, such as uninstallation procedures? What would you consider the pros/cons of one approach over the other?

Matt

Posted 2009-08-26T16:24:09.683

Reputation: 1 857

1For subversion specifically, it's installed with the Developer Tools, which you can get from your Mac OS X install disc. – jtbandes – 2009-08-26T17:12:58.430

Oh yes. Very good point. You should definitely install developer tools -- subversion, gcc, etc. Plus mac goodies like the file comparison tool, and, of course, the tools for mac code development (Xcode, InterfaceBuilder) – Doug Harris – 2009-08-26T17:32:59.887

I have subversion client without XCode installed in Leopard, is it only the server that XCode installs? – The Tentacle – 2009-08-26T17:34:25.687

@jtbandes - I noticed subversion was already installed by default, even though I don't remember installing Developer Tools. However, it was an older version, so was wanting to update it to latest. And I wasn't sure how the default was installed, and therefore wasn't sure the best way to install the update. – Matt – 2009-08-26T17:58:09.883

Answers

4

A .dmg is just a virtual disk ("disk image"), and on its own has nothing to do with installation.

When the disk image contains just an application (usually there will be some explanatory text asking you to drag it to your Applications folder), then all the code and support files are contained within that one file. The application is responsible for doing any setup on first launch and responsible for providing an uninstall mechanism if anything is installed later on. Many developers are using the Sparkle framework to find and install updates.

If the disk image contains a package (.pkg or .mpkg), that's an installer. Running it could install files anywhere on your system and run pre- and post-install scripts, and there's no built-in uninstall or upgrade mechanism (the system does keep a log of installed packages, though, so if you later run an installer package for a newer version of the software, it may behave differently than if it had been a first install). In this case, too, the developer is responsible for uninstall and responsivle for updates. Responsible developers will install to standard directories (/Applications, /Library and ~/Library, /usr, etc.)

For command line software that you'd typically install from source, I'd recommend a package manager like MacPorts (my preference) or Fink over using an installer package. Both of those package managers set up a self-contained directory (/opt and /sw, respectively) with all the support files and executable code for software they install (and most packages respect it), and add themselves to your $PATH. A huge advantage of using a package manager is that it'll keep track of installed software and give you the ability to upgrade or uninstall it.

s4y

Posted 2009-08-26T16:24:09.683

Reputation: 3 469

Thanks! Gave the first 3 answers an upvote because they were all informative, but yours more so! Thanks. – Matt – 2009-08-27T13:10:49.657

4

Installing from a .dmg typically is just a drag and drop to /Applications. Uninstalling is one sore point in the Mac experience, in my opinion. You can delete the file from Applications, but only that stuff which is encapsulated in the .app wrapper will be gone. Any additional configuration files don't disappear.

Another installation path you should consider is MacPorts and/or Fink. These are somewhat similar to apt-get or yum in the linux world. They provide a command line utility for grabbing, compiling and installing common software. It's usually as simple as:

$ sudo port install svn

(macport example)

Doug Harris

Posted 2009-08-26T16:24:09.683

Reputation: 23 578

How do I know if it will be compatable/conflicting with an existing installation of the software? e.g., the Subversion I mentioned was already on the computer, but an older version. I know that multiple versions of software can cause problems, depending on which libraries are linked, if they are in the PATH, which one is in the path first, etc. – Matt – 2009-08-26T18:00:16.167

From the bash command line "type -a svn" will show all executables (and aliases and shell builtins and functions) in the current path -- in search order. The top one is the one that will be executed. The libraries used by the executable will likely be determined by either how it was compiled or by the environment variable DYLD_LIBRARY_PATH – Doug Harris – 2009-08-26T18:28:12.457

You could also wait two days and see if the newer version of svn ships with SnowLeopard (aka Mac OS 10.6). – Doug Harris – 2009-08-26T18:30:54.323

2

This is somewhat complicated, because inside the DMG there may be a simple drag-n-drop solution, or a .PKG, which may install things in any location. .pkg's normally leave reciepts (usually in /Library/Receipts), though OS X offers no easy way to manage those recipts.

Pacifist is a useful app that examines .pkg files (which many command-line apps use for custom install locations) before install so you can understand exactly where things may be installed. You can then determine if your self-compiled version would be installed in the same location or not, and if they will conflict with system versions:

http://www.charlessoft.com/

Specifically, you will need to make sure if they install to different locations, that your path reflects the desired version you wqish to use. I suspect subversion shouldn't be problematic with multiple versions installed... For Ruby, I use a ruby19 name for the ruby executable to stop any path problems with incompatible code.

There is a less-powerful, but free quicklook plugin for .pkg files which does the basic job of show where things will be installed:

http://www.mothersruin.com/software/SuspiciousPackage/

The Tentacle

Posted 2009-08-26T16:24:09.683

Reputation: 4 621