Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Console Foundations Installing Software Introduction to Package Managers

why can't apt uninstall a manually installed package?

Jim Hoskins last words (in the video, not ever) are, "I recommend any time you need to install something, checking to make sure it's available in your package manager. It's much easier to install as well as manage. And when you need to, it's also easier to uninstall than if you had installed from source."

I presume (i.e. maybe not true) that apt is installing a package in the same location as the default when you manually install it. So why can't apt uninstall it? Does it work exclusively off of a log file of it's past installations? and if so, then will you screw things up if you manually delete something previously installed through apt?

4 Answers

Charles Smith
Charles Smith
7,575 Points

I believe it depends on the package manager and how you install it. Package managers have different features. If you're using apt, for example and install a .deb on Ubuntu, I believe it's smart enough to know how to uninstall.

If you're not using a .deb, however, it has no way of knowing what you've installed where. But if you download the source and compile yourself or use another tool for installation, apt will have no idea where files are kept.

If you accidentally delete something from an installed package, I believ most package managers will have a reinstall option of some sort, but you probably want to check out the docs for your package manager of choice.

Charles Smith , thank you. That makes sense.

Mayur Pande
PLUS
Mayur Pande
Courses Plus Student 11,711 Points

so how would you go about uninstalling a manually added package? For example I want to try and uninstall the sqlite that we installed manually

Gianluca Maio
Gianluca Maio
9,128 Points

Mayur Pande: have you resolved the issue on how to properly uninstal a manually added package? I would like to uninstall sqlite from my Ubuntu

Mayur Pande
Mayur Pande
Courses Plus Student 11,711 Points

Gianluca Maio Hi to be honest I can't remember too well what I did! But what I think I did was used command;

sudo apt-get remove sqlite

and then used the purge command to get rid of all its other data;

sudo apt-get purge sqlite

This has been a method I have been using for while to remove programs. So I am 90% sure this is what I did.

Hope this helps

Gianluca Maio
Gianluca Maio
9,128 Points

Mayur Pande Thank you for the tip. When I tried:

sudo apt-get remove sqlite3

it didn't work because sqlite3 was not installed with the apt-get, but it was installed with the source code. After little investigation, I used this command:

sudo make uninstall

and sqlite3 was gone from my system. There were, however, some warnings as the uninstall command is created by the creator of the source code. This means that it might not work for your system. I simply trusted sqlite developers and went ahead with the uninstall command. However, I'd be careful with other packages who are not as popular as, for example, sqllite