(Bear spray/pepper spray is not allowed in Yosemite.) If you have food out and are having trouble scaring the bear away, pack up all your food and leave the area. Throwing food at the bear or leaving food behind will only encourage its behavior and likely result in the bear's death.