Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

4 Answers 4

up vote 14 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
6  
It's also available in homebrew: $ brew install rpm2cpio –  Raymond Jan 17 '13 at 0:15

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

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

 
discard

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.