Tanner, Diana Kirby’s dog, liked to eat tomatoes, fresh from the garden. A wire fence can keep dogs out.

Gardening can be inspirational and fun. Gardening also can be challenging.

With the weather, the pests, the diseases, sometimes gardeners get frustrated. And then there are the animals.

There are wild animals — those whose habitat we’ve invaded and who try to continue to share that space with us. And there are domestic animals — furry family, like cats and dogs — that we’ve actually invited into our gardens. Tomato-eating, bulb-digging, plant-destroying animals.

How can you deal with animals messing (sometimes literally) in your garden? Let’s start with the tame ones.

Dogs

Dogs like to dig. It’s what they do. My dog, Dakota, is particularly fond of bulbs and grubs.

The most obvious way to keep dogs out of your plants is a barrier. Different kinds of small fencing actually can be attractive and not very noticeable, like thin wire fences that fold up and allow you to adjust them to the shape of your bed and stick the wire in the ground along the border. Chicken wire provides for a temporary fix until the dog loses interest. These small fences usually are sufficient to keep dogs from lying down in or snooping around your beds.

For vegetable gardens, more substantial fencing might be needed — after all, food is a powerful enticement. You also can try bird netting in front of or over delicate plants.

Many pet repellents on the market are safe for both dogs and plants. However, cayenne pepper isn’t recommended because it can get in your pet’s eyes.

You also can set aside a specific area in which your pet is allowed to dig. Fill the area in with half sand and half mulch. With some dog toys and a little time spent playing with your pet in that area — doing a little digging yourself — your dog might shift his focus.

Burying some chicken wire under the mulch in your beds also can be a deterrent because dogs and cats won’t like touching it with their paws.

Most dogs like to run along their fence line, and no amount of planting there will deter them. Accepting that behavior will make your life so much easier. Think of that as a permanent garden “condition” and either plant well in front of the space to hide it, or plan a pretty path that both you and the dogs can enjoy.

Dogs also might be less likely to pace and dig around a solid fence if you create cutouts so they can easily look out and see passers-by, instead of being agitated.

Cats

Cats like to use the garden to do their business. You can encourage them to remain in a specific area if you plant some catnip or catmint and provide them with a natural kitty litter area nearby. Keep it clean and they’ll have less reason to go elsewhere in your garden.

In areas where cats like to explore, keep your plants close together. Pets like to have room to roam around.

Place twigs or semi-prickly stems around your plants. You want to make it uncomfortable for the animal to walk on, but not harmful. Don’t use anything with actual thorns that might get lodged in their paws.

Cats generally do not like the scent of citrus. To see if it’s true for your cat, offer him a piece of orange. If your cat runs, you can then put orange and lemon peels in your beds as a deterrent. You also can plant things that have a natural animal repellent scent, like citronella or scented geranium.

Motion-sensor sprinkler heads also can successfully keep dogs, cats and wildlife out of the garden.