7

When I run:

apt-get build-dep <package>

privileged it installs the build dependencies for <package>.

Now, I know that I can use apt-cache depends <package> to see binary dependencies. I haven't found any way to show the same information for build dependencies in a single command invocation, which I could then use to achieve what I want.

So, how can I reverse the effect of a apt-get build-dep <package>, i.e. remove the packages previously installed by an invocation of that command?


Braiam's answer below yields for the packages that are build dependencies:

autotools-dev
debhelper
dpkg-dev
libexpat-dev
libgd2-noxpm-dev
libgeoip-dev
liblua5.1-dev
libmhash-dev
libpam0g-dev
libpcre3-dev
libperl-dev
libssl-dev
libxslt1-dev
zlib1g-dev

The packages the complete apt-get autoremove wants to remove are:

build-essential debhelper dpkg-dev libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev

Especially build-essential isn't desirable here, but I can fix that on my own.

The actual list of packages that got installed were:

debhelper
dh-apparmor
gettext
html2text
intltool-debian
libcroco3
libgettextpo0
libpcre3-dev
libpcrecpp0
libssl-dev
libunistring0
po-debconf
zlib1g-dev
4

Well, no aptitude as I promised (the search terms are a mess) so we need to use the good old apt:

sudo apt-get autoremove $(apt-cache showsrc PACKAGE_NAME | sed -e '/Build-Depends/!d;s/Build-Depends: \|,\|([^)]*),*\|\[[^]]*\]//g')

Reference: http://www.webupd8.org/2010/10/undo-apt-get-build-dep-remove-build.html

  • This appears to work somewhat, but not reliably, going to edit my question with what that gave me. – 0xC0000022L Dec 14 '13 at 3:02
  • sudo apt-mark manual build-essential will leave that package alone. – Ken Sharp Dec 4 '15 at 11:28
0

Tumbleweed writes:

For the future, I highly recommend using mk-build-deps ... instead of aptitude build-dep. That leaves a package ... in your system, [which has dependencies] on the build-deps, that you can easily uninstall later.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.