# Download package with all dependencies.



## cricket (Apr 10, 2017)

Hello.

For downloading 64 bit packages, I use:
http://pkg.freebsd.org/freebsd:10:x86:64/latest/All/

OK, but is it a way to download also all the dependencies and download also the same package for FreeBSD 32 bit with the 32 bit dependencies too (for multi-arch capacities) ?

Thanks.


----------



## ShelLuser (Apr 10, 2017)

pkg-install(8) should be able to handle that for you, look into the -F ('fetch only') parameter.


----------



## cricket (Apr 10, 2017)

Thanks.


----------



## cricket (Apr 10, 2017)

ShelLuser said:


> pkg-install(8) should be able to handle that for you, look into the -F ('fetch only') parameter.


Hmmm, sorry but I forgot to note that I want to download the packages + dependencies for use off-line.

This because some computers do not have internet access and the idea is to use one connected to download the packages+dependencies, copy on usb stick and paste it to the no-connected computers.

Is it possible ?

Thanks.


----------



## ShelLuser (Apr 10, 2017)

cricket said:


> Hmmm, sorry but I forgot to note that I want to download the packages + dependencies for use off-line.


You didn't forgot that up there


----------



## Beastie (Apr 11, 2017)

Of course it's possible. On the target machines, simply run pkg(8) with a local path and complete filename (that is with the extension included).
`# cd /local/package/repository`
`# pkg add ./package-vers.i.o.n.txz`
And that will install the package and all its dependencies as if it was installed remotely using `# pkg install package-vers.i.o.n`


----------



## cricket (Apr 11, 2017)

Beastie said:


> Of course it's possible. On the target machines, simply run pkg(8) with a local path and complete filename (that is with the extension included).
> `# cd /local/package/repository`
> `# pkg add ./package-vers.i.o.n.txz`
> And that will install the package and all its dependencies as if it was installed remotely using `# pkg install package-vers.i.o.n`


Perfect.

Thanks.


----------



## cricket (Apr 14, 2017)

ShelLuser said:


> pkg-install(8) should be able to handle that for you, look into the -F ('fetch only') parameter.



Hello.

Is it possible to define a directory where to store the packages.
Something like this (or a other way) ? :


```
pkg-install -F thepackage.txz -dir /my/directory
```

Thanks.


----------



## Beastie (Apr 14, 2017)

pkg.conf(5):


> PKG_CACHEDIR: string
> Specifies the cache directory for packages. Default: /var/cache/pkg



So... `# echo "PKG_CACHEDIR: /local/package/repository" >> /usr/local/etc/pkg.conf`.

EDIT: I guess setting it in the environment should also work, but I've never tried it.


----------



## ucc (May 21, 2021)

Anybody stumbling on this post should take a look at pkg-fetch(8) which already was around at the creation of the post, and should have been the answer.

`% pkg fetch -o ~/destdir -d pkg-name`

That will download `pkg-name` and all dependencies into `~/destdir/All`.


----------

