# pkg dependencies



## balanga (May 2, 2018)

Is there any way to list the dependencies for any particular pkg?


----------



## ShelLuser (May 2, 2018)

Ayups, using pkg-info(8). `pkg info -dx <partial name>`. This will show the dependencies (-d). You can also check if there are any other packages depending on this one, and well.. tons of stuff. See the manual page.


----------



## Deleted member 48958 (May 2, 2018)

BTW, didn't see nothing about pkg alises anywhere here, on forums.
It is possible to add/change some aliases for pkg via /usr/local/etc/pkg.conf,
and it is very useful. Add them before last "}". Here is mine, for example,
"i" works as "info", "in" - install, "r" - "remove", etc.

```
a: autoremove,
  r: remove,
  u: upgrade,
  up: update,
  in: install,
  i: info,
  s: search,
  S: set,
  c: create,
  w: which,
  l: info -l,
```
So when I want to install a package, I use `# pkg in package`, to mark package as automatically installed — `# pkg S -A 1 package`, etc.


----------



## rigoletto@ (May 2, 2018)

`pkg alias`


```
ALIAS                ARGUMENTS
all-depends          'query %dn-%dv'
annotations          'info -A'
build-depends        'info -qd'
cinfo                'info -Cx'
comment              'query -i "%c"'
csearch              'search -Cx'
desc                 'query -i "%e"'
download             'fetch'
iinfo                'info -ix'
isearch              'search -ix'
prime-list           'query -e '%a = 0' '%n''
prime-origins        'query -e '%a = 0' '%o''
leaf                 'query -e '%#r == 0' '%n-%v''
list                 'info -ql'
noauto               'query -e '%a == 0' '%n-%v''
options              'query -i "%n - %Ok: %Ov"'
origin               'info -qo'
provided-depends     'info -qb'
raw                  'info -R'
required-depends     'info -qr'
roptions             'rquery -i "%n - %Ok: %Ov"'
shared-depends       'info -qB'
show                 'info -f -k'
size                 'info -sq'
```


----------



## Deleted member 48958 (May 2, 2018)

lebarondemerde said:


> ```
> ALIAS                ARGUMENTS
> all-depends          'query %dn-%dv'
> annotations          'info -A'
> ...


All of them are listed in /usr/local/etc/pkg.conf.
	
	



```
# Sample alias settings
ALIAS              : {
  all-depends: query %dn-%dv,
  annotations: info -A,
  build-depends: info -qd,
  cinfo: info -Cx,
  comment: query -i "%c",
  csearch: search -Cx,
  desc: query -i "%e",
  download: fetch,
  iinfo: info -ix,
  isearch: search -ix,
  prime-list: "query -e '%a = 0' '%n'",
  prime-origins: "query -e '%a = 0' '%o'",
  leaf: "query -e '%#r == 0' '%n-%v'",
  list: info -ql,
  noauto = "query -e '%a == 0' '%n-%v'",
  options: query -i "%n - %Ok: %Ov",
  origin: info -qo,
  provided-depends: info -qb,
  raw: info -R,
  required-depends: info -qr,
  roptions: rquery -i "%n - %Ok: %Ov",
  shared-depends: info -qB,
  show: info -f -k,
  size: info -sq,
}
```
Some of default aliases are not very useful, IMO, it is much easier to use
`# pkg info -r package` than `# pkg required-depends package`.
Also "-q" flag is added to many aliases, it forces quiet output,
and some times it isn't very useful, it is only useful if you're using something
like `# pkg install $(pkg build-depends package)`


----------



## ShelLuser (May 2, 2018)

ILUXA said:


> Some of default aliases are not very useful, IMO, it is much easier to use
> `# pkg info -r package` than `# pkg required-depends package`.


I agree with you there, but for some it is much easier to remember required-depends than -qr, especially if you don't use pkg too often.


----------



## balanga (May 2, 2018)

ShelLuser said:


> Ayups, using pkg-info(8). `pkg info -dx <partial name>`. This will show the dependencies (-d). You can also check if there are any other packages depending on this one, and well.. tons of stuff. See the manual page.



That's great, I wouldn't have stumbled upon the '-x'  option if you hadn't mentioned.

Now I have a list of pkgs but some are listed with a tab which I'm trying to remove usind sed...
	
	



```
pkg info -dx mc | sed "s/\\t//"
```
but that doesn't work...   Any ideas?


----------



## balanga (May 2, 2018)

http://scratching.psybermonkey.net/2009/03/sed-t-as-tab-does-not-work.html


----------



## tobik@ (May 2, 2018)

balanga said:


> Now I have a list of pkgs but some are listed with a tab which I'm trying to remove usind sed...
> 
> 
> 
> ...


Yes, use `pkg query '%dn-%dv' mc` instead. That way you don't have to cleanup pkg-info(8)'s output.

If this is about fetching all dependencies for mc for offline installation (per Thread pkg-fetch.65685), note that pkg-fetch(8) has an option for fetching all transitive dependencies of a package as well: `pkg fetch -d mc`

If you combine that with the -o option and with pkg-repo(8) you should be able to create a small adhoc repository for it and let pkg handle dependency resolution instead of installing them manually with pkg-add(8).


----------

