Guidance required for yay config file

This question is a result of another thread where Plasma upgrade to ver 6.4 is being discussed.

Typically to update the system using yay the command that is given is $ sudo yay -Syu. Now yay has a config file that is kept either in $XDG_CONFIG_HOME/yay directory or in the $HOME/.config/yay directory. So when yay is run with sudo, as given earlier, which config file will be picked up? The root’s yay config file or the user which executes the sudo file?

And finally can you please give some pointers on the yay config file? Some links or discussion thread which give more details about the structure of the json config file used by yay. I looked at the man pages of yay and they were maddeningly vague about the config file.

You don’t need to use sudo to run yay, it will ask for permission when it needs it.

To add to what @MyNameIsRichard said, not only should you NOT use sudo with yay, there is no need to add -Syu. Just running yay covers everything you need as the -Syu parameter is built into yay.

You should use yay -Syu when installing software as it will also do an update and prevent a partial upgrade situation.

As @UncleSpellbinder notes above, yay all by itself is equivalent to yay -Syu … No need to add what is already added by the default flag set.

What @MyNameIsRichard is explaining is when you decide to install a program with yay you should use the -Syu flag so that an update can occur while you install the program. It’s always best practice to install programs on a freshly updated system.

But yay is already the built-in alias for yay -Syu

No need to add the flags that are already invoked by yay itself.

Edit: oh, I think I get the distinction you are pointing out. :thinking:

Yay only does -Syu by default when no other parameters are passed. otherwise it’s just yay.

Ah, now I get the point. Yes. Took me a few tries to catch up to the distinction being drawn. Thanks for clarifying.

It’s mostly a list of options mentioned in the manual page, man yay.

I just do yay to update (or rather my alias up), then I’ll install whatever app I want after I update.

How can the yay config file be created? Is there a sample config file that I can use.

Here’s mine ($HOME/.config/yay/config.json):

{
      "aururl": "https://aur.archlinux.org",
      "aurrpcurl": "https://aur.archlinux.org/rpc?",
      "buildDir": "$HOME/.cache/yay",
      "editor": "",
      "editorflags": "",
      "makepkgbin": "makepkg",
      "makepkgconf": "",
      "pacmanbin": "pacman",
      "pacmanconf": "/etc/pacman.conf",
      "redownload": "no",
      "rebuild": "no",
      "answerclean": "",
      "answerdiff": "",
      "answeredit": "",
      "answerupgrade": "",
      "gitbin": "git",
      "gpgbin": "gpg",
      "gpgflags": "",
      "mflags": "",
      "sortby": "votes",
      "searchby": "name-desc",
      "gitflags": "",
      "removemake": "ask",
      "sudobin": "sudo",
      "sudoflags": "",
      "version": "12.0.5",
      "requestsplitn": 150,
      "completionrefreshtime": 7,
      "maxconcurrentdownloads": 0,
      "bottomup": true,
      "sudoloop": false,
      "timeupdate": false,
      "devel": false,
      "cleanAfter": true,
      "provides": true,
      "pgpfetch": true,
      "upgrademenu": true,
      "cleanmenu": true,
      "diffmenu": true,
      "editmenu": false,
      "combinedupgrade": true,
      "useask": false,
      "batchinstall": false,
      "singlelineresults": false,
      "separatesources": true,
      "newinstallengine": true,
      "debug": false,
      "rpc": true,
      "doubleconfirm": true,
      "sortby": "name"
}

Most of these settings are defaults, which can be viewed with yay --defaultconfig. The current config can be displayed with yay --currentconfig.

And this is the only way how software meant to be installed on Arch based systwm.

As ajgringo619 mentioned you can print the default config in your terminal.
I guess you can do it with :

mkdir ~/.config/yay
yay -Pd > ~/.config/yay/config.json

(I don’t remember, but I think that’s what I did)