Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am on a MacBook Pro running Apple Leopard (Mac OS X 10.5.8).

I would like to unpackage a RPM and view the files contained within the wget-1.11.4-2.el5_4.1.src.rpm . I don't need to install the files to a particular location or run any %postinstall scripts or anything. I just want to unpackage this RPM so that I can view the source files underneath.

Is it possible to unpackage a RPM file on a non-RedHat/CentOS system?

share|improve this question
up vote 25 down vote accepted

You can install rpm through Darwin Ports or Fink or Mac Ports or even a Darwin port, rpm4darwin.

To extract files from an rpm package without installing it, use the companion utility rpm2cpio, e.g.

rpm2cpio foo.rpm | cpio -i -d 

There's also a portable rpm2cpio script if you don't want or can't get the version that's bundled with the rpm utility (the script may not work with older or newer versions of the rpm format though).

share|improve this answer
Seems like I want rpm2cpio, and I use Mac Ports, but unfortunately rpm2cpio is not availalbe in macports. Maybe I'll try one of these alternatives. – Stefan Lasiewski Dec 9 '10 at 20:39
@Stefan: Isn't the rpm2cpio utility in the rpm port? If not try the script. – Gilles Dec 9 '10 at 20:48
@Giles : So it is, under /opt/local/bin/rpm! The PATH in my old environment must have been messed up. – Stefan Lasiewski Dec 9 '10 at 21:09
It's also available in homebrew: $ brew install rpm2cpio – Raymond Jan 17 '13 at 0:15

From the command line you can use the tar command.

share|improve this answer
can you give more details ? – Archemar Aug 25 '15 at 12:02
@Archemar tar -tvzf some.rpm to list the contents tar -xvzf some.rpm to extract – jonA Aug 27 '15 at 13:42
Finally, a simple answer! – Alex Barker Mar 8 at 23:23

I would think that (like Windows and Linux) any archiver program should be able to decompress it. iArchiver, the unArchiver, and Archiver all list "read-only RPM" in their supported formats.

share|improve this answer
I guess most popular archivers for Windows - like WinRAR - have no such option. – Maciej Piechotka Dec 9 '10 at 4:06
From my perspective 'archiver' refers to single-purpose tools like /usr/bin/tar, cpio, etc. – Stefan Lasiewski Dec 9 '10 at 21:01

Homebrew also has a recipe for rpm installation, just run

brew install rpm
share|improve this answer

Yes you can. For sure Midnight Commander opens RPM files. I don't use but google list some links that might point at GUI.

share|improve this answer

The portable rpm2cpio script is really good!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.