Stop pkg from installing X components?

When using pkg to install ports, some ports will install with many X components which I will not be utilizing. Is there a way to stop pkg from doing this? Also, is there a way to tell pkg to remove all X components once they have been installed?

An example using phpMyAdmin:

Code:
# pkg install phpmyadmin
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 44 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        phpMyAdmin: 4.6.5
        php56-session: 5.6.28
        php56: 5.6.28
        libxml2: 2.9.4
        pcre: 8.39
        php56-xml: 5.6.28
        php56-bz2: 5.6.28
        php56-ctype: 5.6.28
        php56-filter: 5.6.28
        php56-zip: 5.6.28
        libzip: 1.1.2
        php56-openssl: 5.6.28
        php56-gd: 5.6.28
        libXpm: 3.5.11_4
        xproto: 7.0.28
        libXt: 1.1.5,1
        libSM: 1.2.2_3,1
        libICE: 1.0.9_1,1
        libX11: 1.6.4,1
        libXdmcp: 1.1.2
        libxcb: 1.11.1
        libpthread-stubs: 0.3_6
        libXau: 1.0.8_3
        kbproto: 1.0.7
        libXext: 1.3.3_1,1
        xextproto: 7.3.0
        gettext-runtime: 0.19.8.1
        indexinfo: 0.2.5
        png: 1.6.23
        t1lib: 5.1.2_4,1
        libXaw: 1.0.13,2
        printproto: 1.0.5
        libXmu: 1.1.2_3,1
        libXp: 1.0.3,1
        freetype2: 2.6.3
        jpeg-turbo: 1.4.2
        php56-mcrypt: 5.6.28
        libltdl: 2.4.6
        libmcrypt: 2.5.8_3
        php56-mbstring: 5.6.28
        oniguruma5: 5.9.6_1
        php56-mysqli: 5.6.28
        php56-json: 5.6.28
        php56-zlib: 5.6.28
 
Is there a way to stop pkg from doing this?
This is not possible. The pre-build packages come with the default dependencies.
lso, is there a way to tell pkg to remove all X components once they have been installed?
You can use pkg delete to delete them one by one. See pkg-delete(1). But they will appear again at the next update. And it might be difficult to predict any side effects.

If you do not use X it is likely that your ports are rather small. Then you can build them by yourself with little effort. You can define in /etc/make.conf what options to disable by default. My configuration excludes
Code:
OPTIONS_UNSET+=DOCS
OPTIONS_UNSET+=NLS
OPTIONS_UNSET+=EXAMPLES
I addition to the handbook there are many threads about building from ports on this forum.
 
Why you don't try to built it from ports?

cd /usr/ports/databases/phpmyadmin
make config
make install clean


Also phpmyadmin isn't a webui control panel for MySQL? You don't need X and a browser?
 
I know the question has been more or less answered, but I'd still like to dive in a little deeper because I can imagine how a new user might still end up confused.

When using pkg to install ports, some ports will install with many X components which I will not be utilizing. Is there a way to stop pkg from doing this?
Sort off.

First of all: a binary (pre-compiled) package will always use the default configuration. And to know what that default configuration is you'd need to use a ports tree. If I check on mine then you'll see something like this:

Code:
peter@macron:/usr/ports/databases/phpmyadmin# make rmconfig showconfig
===> No user-specified options configured for phpMyAdmin-4.6.4_1
===> The following configuration options are available for phpMyAdmin-4.6.4_1:
     BZ2=on: PHP bzip2 library support
     GD=on: PHP GD library support (requires X11)
     MCRYPT=on: PHP MCrypt library support
     OPENSSL=on: PHP OpenSSL support
     PDF=off: PHP PDFlib support
     XML=on: PHP XML support (Export to OpenDoc)
     ZIP=on: PHP Zip compression support
     ZLIB=on: PHP ZLIB support
===> Use 'make config' to modify these settings
First I used 'rmconfig' to remove my custom configuration (I have backups ;)) and then I told it to show me the current configuration. Which, due to lack of any, is also the default.

Well, I think this should speak for itself. The option GD is on by default and it requires X11. So if you install PHPMyAdmin like this then it'll automatically pull in that whole requirement.

The solution, as mentioned by the others already: install it from the Ports collection. I'm using it on a server as well which has near to none X11 related libraries (sometimes you need them for specific software). When looking at the dependencies on my version (with my usual custom configuration installed):

Code:
peter@macron:/usr/ports/databases/phpmyadmin# make run-depends-list
/usr/ports/archivers/php56-bz2
/usr/ports/archivers/php56-zip
/usr/ports/archivers/php56-zlib
/usr/ports/converters/php56-mbstring
/usr/ports/databases/php56-mysqli
/usr/ports/devel/php56-json
/usr/ports/lang/php56
/usr/ports/security/php56-filter
/usr/ports/security/php56-openssl
/usr/ports/textproc/php56-ctype
/usr/ports/textproc/php56-xml
/usr/ports/www/php56-session
As you can see: nothing related to X11 at all.

Note though: I'm being brief here. There are 2 kinds of dependencies for a port: for running and for building. And sometimes these two differ. But in this case the only dependency there is ports-mgmt/pkg which is required to be installed anyway.

Hope this can also help.
 
Back
Top