I am personally a huge fan of Delfina Restaurant on 18th near Dolores Park. They do a simple spaghetti that's always just perfectly cooked and delicious, along with a few other changing pasta dishes (but the spaghetti is great!). Reservations are recommended, but if you show up early and sit at the counter, that can work too. Don't get it confused with the Pizzeria Delfina next door, though they offer good pizza as well.
There are many choices, but some other options with well-regarded housemade fresh pasta include Flower+Water (which has pastas a la carte and a $75/person pasta tasting menu, they're serious about their pasta), A16 (I haven't been there in a while though), Cotonga (or, for a really fancy meal, Quince next door), Locanda (Delfina's sister restaurant, which does more Roman food), Perbacco, and SPQR. For a much simpler and casual vibe, consider Emmy's Spaghetti Shack.
Some other lists you might want to consult: 10 of the Best Places to Eat Pasta in San Francisco, 10 Must-Try Pasta Dishes in San Francisco.
Note also that Mac and Cheese is having a bit of a moment in the Bay Area as well. I consider that type of pasta a separate category from the fine Italian homemade pastas above, equally worthy yet clearly distinct, but you could see this article on Where to Get the 12 Best Mac & Cheese Dishes in SF Right Now, along with restaurants specializing in the dish such as MacDaddy in Potrero Hill and Homeroom in Oakland.