# how to pkg install without answering "y/n" by script?



## debguy (May 12, 2021)

I tried to run a script with a list of pkg install, which stopped on "y/n" waiting for input.  I looked for an option to avoid the questions but didn't see any.  I'm unsure about "policy", meaning if I pipe "y/ny/ny/n" if that will work and is typical or if some pkg or port also demand keyboard input?  I ended up typing it all in by hand.


----------



## T-Daemon (May 12, 2021)

pkg-install(8)

```
OPTIONS
      -y, --yes  Assume yes when asked for confirmation before package
                 installation.

ENVIRONMENT
     The following environment variables affect the execution of pkg install.
     See pkg.conf(5) for further description.

ASSUME_ALWAYS_YES
```

pkg.conf(5)

```
OPTIONS

ASSUME_ALWAYS_YES: boolean
                      When this option is enabled pkg(1) will automatically
                      assume "yes" to all questions which require user
                      confirmation before doing anything, as if it the -y flag
                      was specified.  Default: NO.
```


----------



## debguy (May 12, 2021)

thank you.  can't see how i missed that.  i will recheck.  Oh!  tha's a different command.  pkg install, pkg-install.  ok.


----------



## kpedersen (May 12, 2021)

Its the same command, you just can't add spaces in manpage names. Thus the '-'.

Before pkgng formally took over we had pkg_add and pkg-add manpages


----------



## SirDice (May 13, 2021)

`env ASSUME_ALWAYS_YES=yes pkg install -y <packagename>`


----------

