# How i install the source code in FreeBSD?



## SuperuserRoot (Nov 21, 2020)

I installed on my pc, FreeBSD 12.2 with xfce, when I type in the command 
	
	



```
cd / usr / src / release
```
 the message appears saying that the release directory does not exist, when I entered the file manager the src folder was empty, as do I download the source code?


----------



## PMc (Nov 21, 2020)

See the handbook:


> If /usr/src/ does not exist or it is      empty, source has not been installed.  Source can be installed      using Subversion and the instructions      in Section A.3, “Using Subversion”.


----------



## wolffnx (Nov 21, 2020)

SuperuserRoot said:


> I installed on my pc, FreeBSD 12.2 with xfce, when I type in the command
> 
> 
> 
> ...


you are using that cd sintax? or just for the example?


----------



## a6h (Nov 21, 2020)

`ls /usr/src`
? If you have it, then you have it. If you don't:

`mkdir /usr/src`
`pkg install security/ca_root_nss`
`svnlite checkout https://svn.freebsd.org/base/releng/12.2 /usr/src`

Update:
`svnlite update /usr/src`

Clean-up (after failure: disconnected/interrupt):
`svnlite cleanup /usr/src`

Status:
`svnlite status /usr/src`

Info
`svnlite info /usr/src`

[EDIT] Correcting a mistake: unlock => cleanup


----------



## SuperuserRoot (Nov 21, 2020)

vigole said:


> `ls /usr/src`
> ? If you have it, then you have it. If you don't:
> 
> `mkdir /usr/src`
> ...


It work!


----------



## ybungalobill (Sep 20, 2021)

For future googlers: since FreeBSD 13.0 switched to git, one would get the sources following the instructions in https://freebsdfoundation.org/updating-freebsd-from-git/:


```
# pkg install git
# git clone -b releng/13.0 https://git.freebsd.org/src.git /usr/src
```


----------



## scottro (Sep 20, 2021)

Or use gitup which is much smaller, and used just to pull sources and ports.  First check your /usr/local/etc/gitup.conf set the release to what you wish (the default, last I checked was 11.4) and then just type 
`gitup release`


----------



## Alain De Vos (Sep 21, 2021)

I do a

```
git clone -o freebsd -b releng/13.0  https://git.FreeBSD.org/src.git    /usr/src
```

Followed by a regular

```
cd /usr/src
git pull --rebase
```


----------



## Deleted member 30996 (Sep 21, 2021)

During the Base System installation process at the "Distribution Select" screen choose:


```
src
```


----------



## grahamperrin@ (Sep 26, 2021)

SuperuserRoot said:


> It work!



Thanks, you can add the _Solved_ prefix to your thread. Use the edit submenu, near top right.


----------

