# Install package as a dependency



## ompadu (Aug 1, 2017)

Hello, I am coming from Arch Linux and I am trying to find the correct pkg() flag to replicate the `pacman -S --asdeps [I]package_name[/I]` behavior. Context on what this command is and what am I trying to achieve from the pacman wiki: 



> *Installation reason*
> The _pacman_ database distinguishes the installed packages in two groups according to the reason why they were installed:
> 
> 
> ...



Translating from Arch Linux to FreeBSD:


opphan packages in Arch are leaf dependencies in FreeBSD;

`# pacman -S [I]package_name[/I]` is `# pkg install [I]package_name[/I]`

I'm basically looking to replicate the `--asdeps` flag behaviour. Thank you!

Disclamer: _I am aware that FreeBSD is not GNU/Linux, of FreeBSD's history, and that just because a thing is done in GNU/Linux in a certain way it does not mean it's supposed to be done in the same way in FreeBSD, or that it's supposed to be done at all._


----------



## SirDice (Aug 1, 2017)

If I read the explanation correctly, you're looking for pkg-set(8). Specifically the _automatic_ flag.


```
-A 01, --automatic 01
                Set automatic flag for the package: 0 is not automatic, 1 is
                automatic.  This affects the operation of pkg-autoremove(8).
```


----------



## tobik@ (Aug 1, 2017)

This can be done with pkg-install(8) directly as well: `pkg install -A package_name`


----------

