Leash

A leash is a rope that was attached to an animal so the animal cannot roam around or escape. Leashes are essential for buying or transporting animals, because they will often escape, especially dogs, which are very fast.

You can unleash an animal inside a fenced pen and it will stay inside the pen.

Leashing an animal
To leash an animal use the [A] Apply command, select the rope you want to use, press [ENTER] and then point to the direction the animal you want to leash is at. The animal must be next to you. You cannot leash animals in settlements, unless you brought them with you. As of v3.40, animals you have not bought can be leashed but may attack you if you try, meaning you will not be able to milk them or pack items onto them until they calm down. Domestic animals in the wild cannot be leashed.

Every time you buy an animal, you receive a rope from the seller, specifically to use as a leash. Do it the first turn out of the talking screen, as you can easily lose the animal in just one turn.

To unleash, simply [A] Apply the rope holding the animal you want to free (the name of the animal the leash is holding appears next to it in the [I] Inventory screen).