How do I install FreeBSD kernel source code?

by on June 30, 2007 · 8 comments· LAST UPDATED June 30, 2007


Q. I need to configure FreeBSD kernel but not able to find out source code in /usr/src/sys directory. How do I install FreeBSD source code?

A.Your kernel and all related source code is located at /usr/src/sys directory which is also accessible through the /sys path.

If there is not a /usr/src/sys directory on your system, then the kernel source has not been installed. The easiest way to do this is by running sysinstall as root, choosing Configure, then Distributions, then src, then base and sys
# sysinstall

Select Configure
Select Distributions
Select src
Then base and sys > Select ok

Further readings

Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 8 comments… read them below or add one }

1 SIFE September 17, 2009 at 11:41 pm

Salamo Alikom
does any way to get it with cvs ?


2 Cristian Navalici October 6, 2009 at 4:57 pm

Thanks a lot for the information!
It was helpful


3 Dask January 29, 2010 at 5:56 pm

tnks man!
It really help me!


4 Ben February 11, 2010 at 12:26 pm

followed these steps, but got:

Warning: Can’t find the ‘8.0-RELEASE-p2′ distribution on this FTP server.

I chose many different servers. What now?


5 Ben February 11, 2010 at 12:38 pm

actually, need to:

# sysinstall

then change the release name to 8.0-RELEASE and it works fine after that.


6 sateesh June 30, 2012 at 6:04 pm

how do I install sources using pkg_add


7 bsd newbie August 22, 2012 at 6:11 pm

Thanks. It’s very helpful. I have been benefiting from your website. Keep up the good work. :D


8 nixkid November 27, 2012 at 7:51 pm

Sysinstall is mostly dead. It won’t install the source distribution for you any more. But now you can solve this problem in the Howto forum:


Leave a Comment

Tagged as: , , , ,

Previous Faq:

Next Faq: