RPM on MacOS X

Preparation

First you need to install rpm from a tarball. If you have not yet activated the root account, activate it by following the instruction given here so that you can "su" to root.
# su
# gnutar -zxvf tgz/rpm-4.2.1-0.30a-bin.tar.gz -C /
# setenv PATH $PATH\:/usr/local/bin
# rpm --initdb

The "rpm" relies on its own database for inter-dependencies of packages installed as RPMs. In particular it checks the existence of required shared libraries on your system. The problem is that those shared libraries should be registered into the database: it does not matter, as far as the dependency checking is concerned, whether they actually exist or not. Consequently, all of the system's standard shared libraries in /usr/lib need to be listed in the database. I prepared a dummy "system" package that installs nothing ( i.e. it's not going to overwrite any Apple-provided files) but just updates the RPM's database for this purpose. Another problem is that the "rpm" command itself depends on some other packages such as gettext (libintl), bzip2, beecrypt, and db4. Installing the following RPMs will solve these problems.

# rpm -Uvh RPMS/ppc/system-10.3-1b.ppc.rpm --nodeps
# rpm -Uvh RPMS/ppc/gettext-0.12.1-1a.ppc.rpm
# rpm -Uvh RPMS/ppc/bzip2-libs-1.0.2-5c.ppc.rpm
# rpm -Uvh RPMS/ppc/beecrypt-3.0.1-0.20030630.1a.ppc.rpm
# rpm -Uvh RPMS/ppc/db4-4.1.25-14a.ppc.rpm

Notice that you need to specify "--nodeps" when you install the system package, since there is no way to satisfy dependency for this first RPM installation.
In addition, the following RPMs will be needed in many packages:

# rpm -Uvh RPMS/ppc/readline-4.3-7a.ppc.rpm

Now various rpm facilities should be usable. Optionally you can reinstall the "rpm" command itself from RPMs:

# rpm -Uvh RPMS/ppc/popt-1.8.1-0.30a.ppc.rpm
# rpm -Uvh RPMS/ppc/rpm*-4.2.1-0.30a.ppc.rpm

If you have previous 10.2 packages installed, you may need to specify the "--nodeps" flag when you install the db4 package. You should then upgrade the old 10.2 packages that depend on db3.

Notes for Upgrading from 10.2 RPMs

If you have previously installed RPMs for 10.2, make sure to uninstall the libpng-devel package before upgrading. Otherwise the rpm command fails to upgrade it by trying to overwrite a directory with a symbolic link (/usr/include/libpng). Then the rest should be easy. Suppose that you have, in the current directory, the selected 10.3 RPMs to which you want to upgrade, all you need to do is:

# rpm -Uvh *.rpm

Of course, you should remove from the current directory the RPMs you have already installed in the previous steps. Otherwise the rpm command will complain about duplicate installation.
Notice also that 10.3 is now shipped with libdl.dylib (a SysV style dynamic loader), which made the old dlcompat library redundant. You can thus uninstall the dlcompat package after upgrading all of the 10.2 binaries that depend on it.

# rpm -e dlcompat

Basic Usage

Query

$ rpm -qa                       # to see list of all that installed
$ rpm -qi  foo                  # to get information on an installed package "foo"
$ rpm -ql  foo                  # to see list of files belonging to "foo"
$ rpm -qpi bar-1.0-1a.ppc.rpm   # to get information on a pre-installed rpm package
$ rpm -qpl bar-1.0-1a.ppc.rpm   # to see list of files belonging to "bar-1.0-1a"
$ rpm -qf  <filename>           # to check what RPM package owns the file

Installation / Uninstallation

$ rpm -ivh bar-1.0-1a.ppc.rpm                # to install "bar-1.0-1a"
$ rpm -Uvh foo-1.0-2a.ppc.rpm                # to update "foo"
$ rpm -Uvh --oldpackage foo-1.0-1a.ppc.rpm   # to revert this
$ rpm -e   foo                               # to eliminate "foo"

 

Update Record

2001/04/02    Release 0.34w: rpm version 4.0.2 built on MacOS X Public Beta
2001/04/21    Release 0.34a: rpm version 4.0.2 built on MacOS X Release 10.0.01 with some bug fixes:

2001/04/25    Release 0.34b: rpm version 4.0.2 built on MacOS X Release 10.0.01 with previously missing /var/local/{lib/rpm,tmp}.
2001/10/12    Release 0.34c: rpm version 4.0.2 built on MacOS X Release 10.1. You do not need to update RPMs for 10.0.X including those for the rpm itself.
2002/10/14   Release 0.34e: rpm version 4.0.2 built on MacOS X Release 10.2.

2004/01/05 Release 0.30a: rpm version 4.2.1 built on MacOS X Release 10.3.


Back to Keisuke Fujii's HEP on X Page
keisuke.fujii@kek.jp January 13, 2004