I need to install build-dependencies of something, how do I ensure the source code section of my software sources is enabled?
3 Answers
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
- 243
- 2
- 7
-
1NB: You should follow that with an apt-get update otherwise this is not taken into account – Léo Germond Oct 05 '21 at 10:04
Launch the software center and select software sources:

In the software sources make sure "Source Code" is checked:

- 70,934
- 124
- 466
- 653
The default archive repositories have the source archives enabled as well as the binaries. Also, adding any PPAs with sudo add-apt-repository ppa:user/archive should enable the source and binary archives both.
To verify, you can check in the /etc/apt/sources.list file, and in the files in /etc/apt/sources.list.d/, to ensure the deb-src lines for each deb archive line, are there. Also, in the Software Sources properties dialog, you can check that the Source code option is checked on the Ubuntu Software tab, and that there are corresponding Source entries for the Binaries entries, in the list of additional sources under the Other Software tab.
- 40,344
- 5
- 56
- 98