Install a package and all its dependencies without a confirmation prompt with FreeBSD pkg

8,661

Solution 1

Try

pkg install -y webmin nginx nano

Check man pkg-install:

SYNOPSIS

pkg install [-AfgIinFqRUxy] [-r reponame] pkg-origin ...

...

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

Note the y in [-AfgIinFqRUxy]!

Solution 2

Alternatively you can use yes command.

yes | pkg install webmin nginx nano
Share:
8,661

Related videos on Youtube

MDC
Author by

MDC

UNIX, BSD, C, Objective-C, Python, server technologies, software support, Apple Certified

Updated on September 18, 2022

Comments

  • MDC
    MDC almost 2 years

    Is there a way to automatically install packages and their dependencies, like with apt-get -y in Debian, without being prompted each and every time?

    Installing Webmin, NGiNX and nano in 1 step, all their dependancies automatically:

    sudo apt-get -y install webmin nginx nano
    

    On FreeBSD 10, (I'm still getting used to Ports) I would type:

    pkg install webmin nginx nano
    

    If I append the -y switch, it just fails. I looked at the documentation at meBSD and FreeBSD Handbook and there doesn't seem to be an option/switch to use. Any ideas anyone?

    • plas
      plas over 10 years
      Don't get ports and packages confused. You're trying to install a package but said you're still getting used to ports. I only use ports so I can't help you with the new pkg system.
    • MDC
      MDC over 10 years
      Ports is the source code that you then compile yourself and install, whereas pkg installs already compiled binaries. Is that correct?
    • plas
      plas over 10 years
      That is correct.
    • uzsolt
      uzsolt over 10 years
      Did you try pkg install -y webmin nginx nano ?
    • MDC
      MDC over 10 years
      That worked! I was putting the -y switch in the wrong place by using pkg -y install webmin nginx nano .... I can't believe I was unable to think outside the box just a little! Is that somewhere in the documentation and I missed it?
    • uzsolt
      uzsolt over 10 years
      I've wrote it into my answer.