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?


7 Answers 7


On modern systems, the built-in tar utility supports several other archive formats including rpm. So you can extract the files from the rpm with

tar -xf foo.rpm

Note that if you've installed GNU tools, tar may invoke GNU tar instead of the one that ships with macOS, depending on which set of GNU tools and on your $PATH. You need to use /usr/bin/tar, not GNU tar.

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, you can 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).

  • 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. Dec 9, 2010 at 20:39
  • @Stefan: Isn't the rpm2cpio utility in the rpm port? If not try the script. Dec 9, 2010 at 20:48
  • @Giles : So it is, under /opt/local/bin/rpm! The PATH in my old environment must have been messed up. Dec 9, 2010 at 21:09
  • 8
    It's also available in homebrew: $ brew install rpm2cpio Jan 17, 2013 at 0:15
  • Appears rpm2cpio is actually in the rpm brew these days...
    – rogerdpack
    Aug 11, 2017 at 22:19

From the command line you can use the tar command. For example tar -tf example.rpm | less to list all of the files in the rpm.

  • 2
    can you give more details ?
    – Archemar
    Aug 25, 2015 at 12:02
  • 5
    @Archemar tar -tvzf some.rpm to list the contents tar -xvzf some.rpm to extract Aug 27, 2015 at 13:42

To unpack all the files to the local directory:

tar -xvzf some.rpm

without the need to install any new tools


Homebrew also has a recipe for rpm installation, just run

brew install rpm

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.

  • I guess most popular archivers for Windows - like WinRAR - have no such option. Dec 9, 2010 at 4:06
  • From my perspective 'archiver' refers to single-purpose tools like /usr/bin/tar, cpio, etc. Dec 9, 2010 at 21:01

The portable rpm2cpio script is really good!


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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .