Geolocation error: User denied geolocation prompt

I’m putting this here because I ran into a confounding issue that it took me a long time to find a solution for, and I’m hoping to solve the issue for others in the same situation.

You’re using Firefox and OpenStreetMap on a Mac and you’re clicking on the “Show My Location” icon in the toolbar and you’re seeing the error “Geolocation error: User denied geolocation prompt”:

OpenStreetMap screen shot showing geolocaiton error dialog

You’re seeing this despite having granted Firefox permission to use your location for openstreetmap.org:

Firefox permissions dialog for openstreetmap.org

You are confounded. You search for answers, and all you find are references to geolocation and https, but you’re already accessing openstreetmap.org via https, so that’s not the issue.

The issue might lie with your macOS Location Settings:

Screen shot of macOS Location Settings

Open System Preferences > Security & Privacy > Location Services and make sure the Firefox.app settings is checked (you might need to click on the padlock in the bottom-left and enter your system password to be able to make this change).

Once you do this, you should find that the “Show My Location” process works in OpenStreetMap as expected:

Screen shot showing OpenStreetMap Show My Location working in Firefox