43

I'm running Mac OS X 10.6.6. I have some data-only RPMs that I'd like to build.

Until recently I've done most of my development on a VM running CentOS, but one by one I've been able to transition these tasks to the Mac proper. I've been using Fink to access the Open/Free tools I need, but I'm not ready to go to Fink unstable, where the RPM5 package has been for a while.

I've also tried to build the RPM utilities from source, with little luck so far.

Is anyone else building RPMs natively on a Mac? If so, how?

John Trammell
  • 693
  • 1
  • 6
  • 10
  • After tracking down a very weird error, I learned recently that MacOS has a case-insensitive (but case-preserving) filesystem. This is inadequate for my daily needs, so I'm back to using the VM with a decent Unix variant installed. – John Trammell Jun 27 '11 at 11:47
  • 3
    When doing an install of Mac OS X on your machine, you have the option to format the drive as: Mac OS Extended (Case-Sensitive, Journalled) This will give the case-sensitivity that you want for Unix work. – user132447 Jul 08 '11 at 23:15
  • Have you tried the DMG archive from [RPM for Darwin](http://rpm4darwin.sourceforge.net/)? There is an RPM for 5.0 and 5.1. No comment on this site if 5.x is working on OS X 1.6, they just say minimum requirement is 10.4/10.5 – Nachtfrost Mar 09 '11 at 15:25
  • 2
    all those links on the RPM for Darwin page are dead ... –  Jun 21 '11 at 21:18
  • 1
    The links to the 5.0 and 5.1 versions of RPM are not dead. The RPM utility, once installed, does not function well enough to create an RPM however. Apparently there is a custom bash change that needs to be made to get a build. Did you actually try it, or did you just google and post? – John Trammell Jun 27 '11 at 11:43

4 Answers4

60

You can install rpmbuild on MacOS using Homebrew package manager.

brew install rpm

This installs a bunch of packages including rpmbuild which is used to build an rpm. You can then run the following command to create an rpm

rpmbuild <specfile>
Ravi Naik
  • 739
  • 7
  • 6
  • 1
    this should be the accepted answer - the problem is now obsolete and this is the simplest way to install rpm – Eliran Malka Aug 02 '16 at 11:58
  • Brew is the easiest way to handle this issue. This should be the accepted answer. – sheldonkreger Mar 21 '17 at 17:29
  • Brew is the easiest way to handle this issue, but many macOS users prefer to stay away from it due to various reasons (permissions, ruby versioning, package versioning, ...). – JMess Aug 23 '17 at 18:26
14

I was in this same situation today, but I've just successfully built and run rpm by first installing MacPorts and then installing from there. It requires an absolutely ludicrous 1.8GB of downloads before you can even build because it requires installing the (free) Xcode developer tools package from the Apple Store at 1.6GB, then another 140MB package of command line tools.

So, first carefully follow every step of the clear instructions here to install MacPorts: http://www.macports.org/install.php

After doing all that, be sure to run the update command (as mentioned in the install instructions) so that it downloads the available software ports package (it'll say "can't find rpm" if you don't):

sudo port -v selfupdate

Once all that is done, run the following to fetch rpm and build it:

sudo port install rpm

On my early 2011 MacBook Pro with Lion, it took about 10 minutes to download everything and build.

The whole process takes a while, but it works. Good luck!

Nathan Beach
  • 2,497
  • 2
  • 24
  • 25
  • PS: I have since noticed that the additional "sudo port -v selfupdate" is not needed in most situations... turns out it was my company firewall that was blocking it from working. The MacPorts installer should do this step for you automatically. – Nathan Beach Mar 26 '13 at 16:37
  • Downvoted because this answer is obsoleted by `brew install rpm` as outlined in another answer. – Mark Edington Apr 07 '17 at 22:53
4

As @user132447 pointed out, you will need to reformat the drive to MacOS extended (case sensitive).

The rpm which is part of CentOS is different then the RPM5 build. Both are two different projects. And later may work on MacOS, but I would recommend you to go using VMs (or separate systems) which are RPM based only. That will surely save you long hours of fixing and caring about not so useful issues.

RPM from rpm.org doesn't support MacOS yet (it builds I guess - at least the latest version), and this is the rpm which CentOS uses.

1

I've been using RPM for Darwin for building maven based projects that create RPM artifacts.

dewtea
  • 476
  • 4
  • 5