Extract an RPM Package on MacOS

Published Tuesday, Oct 29, 2019 by Tony Davis

Background

I needed to extract the contents of an RPM on my Macbook to view the standard contents of a configuration file.

Procedure

Download Homebrew for MacOSX.

MacBook:~ user$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install rpm2cpio utility.

MacBook:~ user$ brew install rpm2cpio
==> Downloading https://homebrew.bintray.com/bottles/rpm2cpio-1.3.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring rpm2cpio-1.3.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/rpm2cpio/1.3: 3 files, 4.3KB

Extract RPM package.

MacBook:~ user$ rpm2cpio.pl ntp-4.2.6p5-28.el7.centos.x86_64.rpm | cpio -idmv
./etc/dhcp/dhclient.d
./etc/dhcp/dhclient.d/ntp.sh
./etc/ntp.conf
./etc/ntp/crypto
./etc/ntp/crypto/pw
./etc/sysconfig/ntpd
./usr/bin/ntpstat
./usr/lib/systemd/ntp-units.d/60-ntpd.list
./usr/lib/systemd/system/ntpd.service
./usr/sbin/ntp-keygen
./usr/sbin/ntpd
./usr/sbin/ntpdc
./usr/sbin/ntpq
./usr/sbin/ntptime
./usr/sbin/tickadj
./usr/share/doc/ntp-4.2.6p5
./usr/share/doc/ntp-4.2.6p5/COPYRIGHT
./usr/share/doc/ntp-4.2.6p5/ChangeLog
./usr/share/doc/ntp-4.2.6p5/NEWS
./usr/share/man/man5/ntp.conf.5.gz
./usr/share/man/man5/ntp_acc.5.gz
./usr/share/man/man5/ntp_auth.5.gz
./usr/share/man/man5/ntp_clock.5.gz
./usr/share/man/man5/ntp_decode.5.gz
./usr/share/man/man5/ntp_misc.5.gz
./usr/share/man/man5/ntp_mon.5.gz
./usr/share/man/man8/ntp-keygen.8.gz
./usr/share/man/man8/ntpd.8.gz
./usr/share/man/man8/ntpdc.8.gz
./usr/share/man/man8/ntpq.8.gz
./usr/share/man/man8/ntpstat.8.gz
./usr/share/man/man8/ntptime.8.gz
./usr/share/man/man8/tickadj.8.gz
./var/lib/ntp
./var/log/ntpstats
2822 blocks

Done.

comments powered by Disqus