2Heat oil in large skillet over moderately high heat but not smoking, and sauté onion for 2 minutes. Add half of the grated potatoes, and spread to make a thin layer, and press down on potato layer with a spatula. Sprinkle onion and garlic over potatoes. Reduce heat to moderate and sprinkle the Gruyère over the potatoes. Spread remaining grated potatoes on top, pressing down again with spatula. Cook until golden brown and crisp, about 10 minutes on each side. Season potatoes with salt and pepper.