Yay command line for Optional Dependency (New here)

Hello! I’m trying my best to be a more Arch user and use that command line as much as possible I really enjoy Yay well kind of! I still use pamac to see if I haven’t destroy anything!..
I run only a laptop and surprisingly my package never really work until I install the Optional dependency “Gestures” is a good example of that…
So I get the point of yay -Si that give you all the info about the Optional dependency but how do you install all of them at once linked to that personal package so he does not end up into a Orphan package? So this was really good help with the example of Wine But that do not make any sense to me…
If someone could explain me how to install them in easier way I would gladly appreciated it!


`sudo` `pacman -S --asdeps --needed $(pacman -Si wine | ` `sed` `-n ` `'/^Opt/,/^Conf/p'` `| ` `sed` `'$d'` `| ` `sed` `'s/^Opt.*://g'` `| ` `sed` `'s/^\s*//g'` `| ` `tr` `'\n'` `' '` `)`

Thanks you!!!

Go into pamac GUI, go to the package you want to install, check the dependencies, press install button on each optional dependency.

The article already explains in detail what you’re asking about; i.e.,

yay -S --asdeps package1 package2 package3

Yay uses the same options as Pacman, so check man pacman and the Arch Wiki Pacman arcticle for more info.

Please use the Preformatted Text </> button instead of the Quote " button for terminal output.

1 Like

can replace sed by awk

pacman -Si vlc | awk -F':' '/^ .*: / {print $1}'

ps: regex is different for wine ! wine is not standard ! : no description…
for all ? sed -n '/^%OPTDEPENDS/,/^$/p' /var/lib/pacman/local/vlc-*/desc | awk -F':' '{print $1}' | tail -n +2

but, yes gui for that is the best

what you want to do (all opt deps ) is extremely rare : usefull one time in 5 years ? it’s a strongly discouraged practice

1 Like

There is expac for things like that.

expac -S "%o" wine
1 Like

expac is for quering the package database, not installing packages. See man expac and pacman/Tips and tricks - ArchWiki

However, you should be able to pipe a list of packages to Pacman. However, Trilby’s command on the Arch forums isn’t working for me. :thinking:

Yes, it’s for extracting whatever info you need. I’m just giving OP a cleaner alternative to jillion pipes and sed commands.

Edit: Not working for me either. Even if it did, it wouldn’t work as OP wishes - it would install all packages explicitly.

Thanks for the pacman article i check man pacman but I could not find anything about optional package… I did not realize that you have to manually install every optional package manually I was looking for a command to just install all the optional in one go… So for example:

yay -Si google-chrome

to check optional dependency

Then yay -S google-chrome

and then yay -S --asdeps (all the optional dependency needed)

that should be correct?

Yes, as I outlined above.

Well, except you’ve got an extra yay -S in there:

1 Like

a dependency adds one functionality to our application (we can view as a plugin) - so if we are missing a feature: we add the package
we add all only if we want all

if you view vlc (pacman -Si vlc), we add for example libva-vdpau-driver ONLY if we have a nvidia card and want “vdpau”
wine package is a exception because we not have descriptions, so is hard to make a choice

1 Like

Awesome thanks you so much its all make sense now! Much appreciate it!

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