tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Moving files out of PREFIX on macOS



September 30, 2026 at 2:42 PM, "Greg Troxel" <gdt%lexort.com@localhost mailto:gdt%lexort.com@localhost?to=%22Greg%20Troxel%22%20%3Cgdt%40lexort.com%3E > wrote:


> 
> ivan%ivanpollak.com@localhost mailto:ivan%ivanpollak.com@localhost  writes:
> 
> > 
> > According to the documentation it is officially recommended to use
> >  INSTALL/DEINSTALL to handle cases where files should go outside of
> >  the ${PREFIX}. [1]
> > 
> I read that as "files really shouldn't be installed outside of $PREFIX
> but if you have to here's how", not "it's great to put things outside of
> $PREFIX.
Thats a good point, however aren't macOS .app bundles a *special case*? MacOS
in general is quite a weird platform... I mean system apps in an upper case
letter root directory :?
> 
> > 
> > Also im pretty sure that .App's would be the preferred way of building
> >  and installing packages due to them being integrated with the base
> >  system. XQuartz, the project that allows X11 programs to run on macOS
> >  is a third-party solution.
> > 
> Some prefer that I'm sure :-) pkgsrc in general attempts to build things
> the same way on all systems, which is the other argument.

Thats also a very good point. I didn't use XQuartz that much and thus im not
very familiar with the process of launching apps there but it might be worth
to investigate if this could be a better solution to just use Xquarz for most
applications. However my issue with that is that then pkgsrc heavily relies on
Xquarz to be supported in the future and with X11 slowly fading in favour of
wayland this may cause some issues. Some of my favorite linux applications are
wayland native or only available on wayland. I think the more safe approach would
be to use macOS's native system rather than relying on a translation layer but
as I said, it is worth investigating.

> 
> > 
> > .App's also *should* be self-contained and not have any dependencies
> >  outside of themselfs [7], thus skipping shlib things should not be a big issue.
> > 
> pkgsrc doctrine is that libraries should not be vendored, so that when
> they are security-bug-fixed and packages rebuilt, all packages have the
> fix. This is messy given rust attitudes and similar. Are you saying
> that every upstream that builds an app either has no non-base-os
> dependencies (even with PREFER_PKGSRC) or does static linking, or ?

MacOS is quite weird as I said above. Application bundles (.app's) usually have 
everything that they need bundled. They are essentially a folder that the macOS
recognizes as an application bundle. For example UTM does package every framework
that it needs with some version. To take a look at it just cd into the .app. There
is one "Contents" and in the case of UTM, UTM.app/Contents/Frameworks is the directory
where the libraries are located.

This means that application bundles are not staticially linked but are somewhat
similar. They do contain everything that an application needs to run but the binary
does dynamically link against the libraries in the application bundle.

I think that it is safe to say that macOS does things differently and this can be
for the better but in this case it probably is for the worse. I do not have any rights
to tell the pkgsrc team anything and I do not want to but it would be very nice to see
some tighter integration into this operating system. If not, I would be fully in with
a soft fork that just adds some macOS specific INSTALL/DEINSTALL scripts for some 
packages but it would be even better if this could be integrated into pkgsrc in some 
way.

> 
> > 
> > Both Homebrew and MacPorts just copy over the file if im not completely wrong.
> >  Homebrew puts some Apps into ~/Applications and ~/Library/Fonts, MacPorts
> >  creates /Applications/MacPorts for the Applications from the packet manager.
> >  [2],[3],[4],[5],[6]
> > 
> Interesting. I guess as mac-only packaging they can just go the mac way
> and discount the rest of the world.

Homebrew actually is also usable on Linux and allows for unpriviledged installations.
Many immutable distributions like bazzite or secureblue ship it by default but even
on there they do things quite weird. They have their own seperate user for installing
programs and also they do some quite funky things on macOS with the permissions for 
the installation folder (/opt/homebrew i think).

Best regards,
Ivan (arcathrax)


Home | Main Index | Thread Index | Old Index