Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use the command line installer to automate installs UNIX
Mac OS X includes the tool /usr/sbin/installer, which is a command-line version of the Installer application.

By passing it command line parameters, you can install anything that's in a .pkg or .mpkg package. This could be useful for login scripts or other automatic methods of deploying software.

[Editor's note: The Read Me explains things pretty well, and includes a number of examples.]
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)

Use the command line installer to automate installs | 8 comments | Create New Account
Click here to return to the 'Use the command line installer to automate installs' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Authored by: mervTormel on Dec 11, '02 10:11:24AM

the Read Me ? i think rob means the man page.

man installer

[ Reply to This | # ]
also softwareupdate
Authored by: merlyn on Dec 11, '02 11:05:05AM
Noticed softwareupdate when I was staring at the manpage for installer. That could come in handy too.

[ Reply to This | # ]
installer and developer tools
Authored by: lx on Dec 11, '02 11:17:14AM

I tried to use the installer command to install the developer tools but it failed on DevSDK.pkg, so I am guessing not everything can be installed conveniently from the command line. Anyone else have experience with installing the developer tools this way?

[ Reply to This | # ]
installer and developer tools
Authored by: vonleigh on Dec 11, '02 10:00:49PM


I managed to install the developer tools on a remote box through ssh. My frist problem was of course mounting the disk image, which I achieved with:

hdiutil mount Developer.dmg

Then I installed the installer. Now an important thing to remember is that you have to tell it _where_ to install the dev tools. If you try and install them as they are:

installer -pkg Developer.pkg

It will try to install it on the disk image you just mounted, instead of your active OS and fail (of course the error message doesn't really help). So be sure to set the target

installer -pkg Developer.pkg -target /


P.D: all typed in Omni, didn't double check with terminal, so if there's any mistakes look up the man pages.

[ Reply to This | # ]
installer and developer tools
Authored by: vonleigh on Dec 11, '02 10:03:56PM


*Then I installed the Developer Tools (not package).


To unmount your image do

hdiutil -detach /dev/disk#

The number of the disk will be given to you when you mount the image. If not you can look it up with df.

[ Reply to This | # ]
installer and developer tools
Authored by: lx on Dec 12, '02 01:48:42PM
I wasn't able to mount the disk image on my remote headless machine (a beige G3 tower) for some reason unbeknownst to me (because it doesn't have a monitor attached?), so I copied the individual packages over and attempted to install them from a directory in my user account via sudo. A peculiar thing happened with this approach: the installer claimed the first package, DevTools.pkg with the compilers and so on, was installed successfully but it wasn't! As I just found out, this caused the DevSDK.pkg install to fail because /usr/bin/cc wasn't there. I finally did get everything to install by issuing the install commands, sudo installer -verbose -pkg ~/DevSDK.pkg -target / -verbose and such, from the root directory! Lesson learned: the installer may lie to you by saying it was successful when it wasn't!. It looks like Apple's installer is still very fragile. It's unfortunate that such a "new" operating system already has a long history of defects with such fundamental functionality.

[ Reply to This | # ]
os installs using /usr/sbin/installer
Authored by: jpm on Dec 12, '02 01:07:22AM
i wrote up some instructions from my notes for installing mac os x while rooted off an install cd in single user mode. this can be significantly faster than using the graphical installer...
mind you - use at your own risk.

[ Reply to This | # ]
Absolute paths
Authored by: sven on Jan 05, '03 05:05:18PM

I have found in one case that the installer reported success but didn't install anything. The -dumplog option releaved that it actually couldn't find the included pax.gz archive and bailed out. Giving the -pkg option the absolute path to the package made it work.


[ Reply to This | # ]