Ubuntu – How to enable the source code repositories


I need to install build-dependencies of something, how do I ensure the source code section of my software sources is enabled?

Best Answer

You can enable source code repositories by uncommenting (removing #'s) deb-src repositories from /etc/apt/sources.list.

sed -i '/deb-src/s/^# //' /etc/apt/sources.list && apt update

If you want to disable source code repositories, you can comment it back

sed -i '/deb-src/s/^/# /' /etc/apt/sources.list && apt update