Installing packages to a specific directory

Hello to everyone at the Manjaro forums! Keen to be here! :grinning_face_with_smiling_eyes:

I want to install a package in a different location. I have tried various commands like sudo pacman -S <package_name> --root /chosen/directory/ and sudo pacman -S <package_name> --sysroot /chosen/directory/, but they both don’t do what I want them to.

I only want to install one particular package (and maybe its immediate dependencies) to this particular location, since I don’t want it on my main drive (the target directory is on a drive mounted at /mnt/sdb).
Is there anything I can do? A command line argument I overlooked? I have scoured the manpage, but I really can’t find anything.

Any help would be greatly appreciated. Thank you for your time :smiley:

Welcome to the forum!

I’m afraid what you wish to do is a Windows-ism. GNU/Linux is a UNIX operating system, and UNIX doesn’t work that way.

The package always contains the paths to where the files from the package will be installed because UNIX is an integrated system. Once the package has been installed, its files will be distributed along the various directories of the filesystem hierarchy. So for instance, the shared libraries will always go under /usr/lib, the executables under /usr/bin, and so on.

The only exception to that rule are the games and stuff that you install through Lutris or Steam, because those are actually Windows games that have been made to run in GNU/Linux by way of a translation layer.

Now, the above all said, Snaps and Flatpaks are also different in that regard, because they are containerized applications ─ they are not integrated with the rest of the operating system ─ but even they normally have their designated directories contained in the package itself.

There is also certain third-party software that doesn’t come installed through the distribution’s package manager ─ although there are exceptions to that rule, e.g. Discord ─ and that comes with an installer of its own, usually in the form of a self-extracting archive. Those packages will then normally go under /opt, although ─ as I mentioned ─ Discord is one of those weird ones; it installs partly under /usr and partly under /opt.


Thank you for that explanation! I’ve already learned a lot more about how UNIX systems manage packages, and explains a lot of the reasons why it looks like magic!
I guess I’ll just build it from source. When building something from source, are there easy ways to overwrite and update it? Does the only way to do it by deleting the old version and building the new version in its place? Are there any ways to go around that?

what is this package ??? (source url)
it is impossible to answer without any technical information about your application !

not possible, dependencies are always in system partition (/)

why ? we install all apps in system partition (we use linux :slight_smile: ). If is a script or appimage, why not in another partition

Hi @papajoke ! Sorry, I’ll be more specific about what I want to do.

So I’m looking to install OpenMW - what I have been doing in the past is building it from source, placing that on my ‘Games’ drive (since I keep all my games on a separate mounted drive), and playing it from there. I wanted to mod it easier, so I decided to use the portmod package alongside it (which creates mod lists for OpenMW). Since OpenMW is also in the [community] repository, I thought I could maybe install openmw (from the [community] repo) in a location that I wanted, install portmod (in the AUR) alongside it, find a way of linking portmod to the OpenMW install, and I could easily keep both updated through the system package manager, and not lose all my mod lists and configuration tweaks when I did so.

So a bit of a confusing way to go, but I thought “Why not give it a try?”, since there’s usually a way of getting things working the way that I want (So much freedom!). But by the sounds of it it’s not actually possible, so then I’ll need to go back to building from source. But then I’m wondering if there are easy ways to keep it updated without breaking stuff.

That’s the whole kaboodle of what I’m trying to do :slight_smile:


So I know OpenMW keeps configuration files and save files and things like that in a different location, so I figure it’s easily possible to overwrite the source without issues. However I think Portmod (although I haven’t used it yet) keeps local copies of the mod files, which might likely mess things up (I reckon).
I just thought it’d be easier to do things through the system package manager (since the binaries are on there), but maybe doing something like this is more complex overall.


Sorry, I had originally hyperlinked stuff in my post, but for some reason I can’t include links in my posts. So I’ll just put the links separately here (formatted badly with spaces since I can’t include links in my posts).

Thank you :blush:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.