"There were ups and downs," Gabbert said. "But we saw when we got into the groove what we can do as a unit."
"Was it completely what I wanted tonight? Absolutely not. But rarely is it ever," Osweiler said. "I think the biggest thing about tonight is we did some really good things offensively and we know we have some things that we need to work on and grow and get better at."
With Kaepernick sitting out with tightness in his throwing shoulder, Gabbert got to make his case in the battle to win San Francisco's starting quarterback job for first-year coach Chip Kelly.
Gabbert, who started the final eight games last season, did little to improve his position in the first two drives. He was off-target on his first two passes as San Francisco went three-and-out in 41 seconds on the opening drive and started the game 1 for 6 overall.
But he was much more effective on the third drive when he scrambled 13 yards for a first down and then hit McDonald for the long score when Benardrick McKinney slipped in coverage.
"The good thing is that he did settle down," Kelly said. "There were some real positives that we can build on but there were some throws that even if you ask Blaine, he'd say he wished he had those back."
Gabbert finished 4 for 10 for 63 yards and a touchdown.
Osweiler, who signed a $72 million, four-year contract with Houston in the offseason, went 4 for 7 for 27 yards. He took one sack and left for good after throwing an incomplete pass to Braxton Miller on fourth down early in the second quarter.
"To put on the Texan uniform, and run out of the tunnel as a team for the first time, it was certainly special," Osweiler said.
Copyright 2016 by The Associated Press