Skip to content

Instantly share code, notes, and snippets.

@varenc
Created December 17, 2023 00:05
Show Gist options
  • Save varenc/3ff42fe93a330d9071d89bd7d15bd3b6 to your computer and use it in GitHub Desktop.
Save varenc/3ff42fe93a330d9071d89bd7d15bd3b6 to your computer and use it in GitHub Desktop.
Automatically open the macOS Weather app from the the terminal/shell for a given GPS lat/long
open -a Weather "https://weather.apple.com/?city=Boston&lat=42.3226734&lng=-71.0924375"
# the 'city' arg can be any string, only the lat/lng is used to look up weather
# You can make the string somethng silly and it gets displayed in the app
open -a Weather "https://weather.apple.com/?city=Bawston&lat=42.3226734&lng=-71.0924375"
# Or if you exclude 'city' arg then Apple just looks up the name based on the lat/long
open -a Weather "https://weather.apple.com/?lat=42.3226734&lng=-71.0924375"
# Also all of these have `weather://` scheme equivalents, like this:
open 'weather://?city=Boston&lat=42.3226734&lng=-71.0924375'
# REQUEST:
# If you know how to open the Weather app with a search string, like "Boston, MA", instead of a lat/lng,
# let me know! I suspect it's just another query arg I haven't discovered yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment