APT/RPM on MacOS X

Preparation

In what follows, I assume that you have already installed the latest X window system (X11-2.6.3 on my Mac box) and developer tools (Xcode-4.2). If you haven't, install them before you proceed. Notice also that I am going to use bash unless otherwise stated.

First you need to install the minimal set of the APT/RPM system using the MacOS X Workshop installer. Besides acting as a can opener the installer will replace some of your dot-files in your home directory with your original files backed up appending the post fix, ".rpmorig", if any. Modify, for instance, "~/.bashmyrc" instead of "~/.bashrc" as needed to reflect your preferred settings in your original "~/.bashrc".

If you have not yet activated the root account, activate it by following the instruction given here so that you can "su" to root. Then type in the following from a terminal window to install the base APT/RPM system:

$ su
# apt-get update
# apt-get install OSX-base
# apt-get clean

Notice that when the prompt is '#', it means that you type in the command that follows it as root, while the prompt is '$', you type in the command as an ordinary user. This rule applies through out this web site.

You are now ready to use the APT/RPM system to install any HEP on X package.

Basic Usage of APT

The apt figures out inter-dependencies of various packages and automatically installs required packages as well as the target package you chose to install. The HEP on X's apt is so setup that it will download and install these packages from the HEP on X site, this web site. For this to work properly, first you have to synchronize your apt database with the one at this site as follows.

# apt-get update

Then you can install any package, say foo, by typing in

# apt-get install foo

If foo depends on some other packages, the apt will ask you whether you want to go ahead and install all of the necessary packages to satisfy dependencies. When you have already installed foo, it will do nothing. If a newer version is available, it will update foo.

To upgrade all the packages already installed, do

# apt-get dist-upgrade

instead.

After you install all of the packages you wanted to install, do

# apt-get clean

so as to clean up the RPM packages downloaded into /var/local/cache/apt/archives/.

If you want to uninstall foo, type in

# apt-get remove foo

If you are looking for a package, say bar, try

$ apt-cache search bar

to get a list of packages that are relevant.

Basic Usage of RPM

Sometimes you may want to treat RPMs directly for query purpose. In such a case, the following may come into handy.

$ 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.x86_64.rpm   # to get information on a pre-installed rpm package
$ rpm -qpl bar-1.0-1a.x86_64.rpm   # to see list of files belonging to "bar-1.0-1a"
$ rpm -qf  <filename>           # to check what RPM package owns the file

If you have an RPM package, you can also directly install it with the rpm command as follows.

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

Acknowledgement

In preparing the APT tree for HEP on X, I depended so much on the information available from Dr. Taizo Kobayashi's wonderful site, MacOS X WorkShop (in Japanese), where he started the first apt-rpm-based distribution for MacOS X, aiming mainly at Japanese research workers who need Japanized versions of unix tools such as TeX, ghostscript, etc. on MacOS X. I would like to express my sincere thanks to him for bringing his site to my attention and providing me with a lot of useful information.


Back to Keisuke Fujii's HEP on X Page
keisuke.fujii@kek.jp May 3, 2012