Skip to content

Instantly share code, notes, and snippets.

@talkingmoose
Last active December 10, 2023 17:14
  • Star 13 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save talkingmoose/1b852e5d4fc8e76b4400ca2e4b3f3ad0 to your computer and use it in GitHub Desktop.
Regex looks for all Mac models compatible with macOS Sonoma. May not be up-to-date with newly released models.
https://support.apple.com/en-us/HT213772
Published Date: November 15, 2023
Verification: https://regex101.com/r/GCfKMt/9
1) Exact regex — Matches major model identifier numbers based on Apple's knowledge base article (more accurate):
^(Mac(1[345]|BookPro1[5-8]|BookAir([89]|10)|Pro7)|iMac(Pro1|(19|2[01]))|Macmini[89]),\d+$
2) Current or higher regex — Matches model identifiers based on Apple's knowledge base article and may match higher versions before this regex is updated (more future-proof).
^(Mac(1[3-9]|BookPro1[5-8]|BookAir([89]|10)|Pro[7-9]|Book\d{2,})|iMac(Pro\d+|(19|[2-9]\d))|Macmini[89]),\d+$
Current or higher regexes aren't available for some models where Apple has used the same model identifier schema for multiple models.
Either regex will match any of the supported following model identifiers:
MacBook Pro
https://support.apple.com/en-us/HT201300
Exact regex: ^Mac(15,([36-9]|1[01])|14,([5679]|10))|MacBookPro1[5-8],[1-4]$
Current or higher regex: Not available
Supported:
Mac15,11
Mac15,10
Mac15,9
Mac15,8
Mac15,7
Mac15,6
Mac15,3
Mac14,10
Mac14,9
Mac14,7
Mac14,6
Mac14,5
MacBookPro18,4
MacBookPro18,3
MacBookPro18,2
MacBookPro18,1
MacBookPro17,1
MacBookPro16,4
MacBookPro16,3
MacBookPro16,2
MacBookPro16,1
MacBookPro15,4
MacBookPro15,3
MacBookPro15,2
MacBookPro15,1
Unsupported:
MacBookPro14,3
MacBookPro14,2
MacBookPro14,1
MacBookPro13,3
MacBookPro13,2
MacBookPro13,1
MacBookPro12,1
MacBookPro11,5
MacBookPro11,4
MacBookPro11,3
MacBookPro11,2
MacBookPro11,1
MacBookPro10,2
MacBookPro10,1
MacBookPro9,2
MacBookPro9,1
MacBookPro8,3
MacBookPro8,2
MacBookPro8,1
MacBookPro7,1
MacBookPro6,2
MacBookPro6,1
MacBookPro5,5
MacBookPro5,4
MacBookPro5,3
MacBookPro5,2
MacBookPro5,1
MacBookPro4,1
MacBookPro3,1
MacBookPro2,2
MacBookPro2,1
MacBookPro1,2
MacBookPro1,1
---------------------------------------------------
MacBook Air
https://support.apple.com/en-us/HT201862
Exact regex: ^Mac14,(2|15)|MacBookAir([89]|10),\d$
Current or higher regex: Not available
Supported:
Mac14,15
Mac14,2
MacBookAir10,1
MacBookAir9,1
MacBookAir8,2
MacBookAir8,1
Unsupported:
MacBookAir7,2
MacBookAir7,2
MacBookAir7,1
MacBookAir6,2
MacBookAir6,1
MacBookAir5,2
MacBookAir5,1
MacBookAir4,2
MacBookAir4,1
MacBookAir3,2
MacBookAir3,1
MacBookAir2,1
MacBookAir1,1
---------------------------------------------------
iMac Pro
https://support.apple.com/en-us/HT210222
Exact regex: ^iMacPro1,\d$
Current or higher regex: ^iMacPro\d+,\d$
Supported:
iMacPro1,1
---------------------------------------------------
iMac
https://support.apple.com/en-us/HT201634
Exact regex: ^Mac15,[45]|iMac(19|2[01]),\d$
Current or higher regex: Not available
Supported:
Mac15,5
Mac15,4
iMac21,2
iMac21,1
iMac20,2
iMac20,1
iMac19,2
iMac19,1
Unsupported:
iMac18,3
iMac18,2
iMac18,1
iMac17,1
iMac16,2
iMac16,1
iMac15,1
iMac14,4
iMac14,3
iMac14,2
iMac14,1
iMac13,2
iMac13,1
iMac12,2
iMac12,1
iMac11,3
iMac11,2
iMac11,1
iMac10,1
iMac9,1
iMac8,1
iMac7,1
iMac6,1
iMac5,2
iMac5,1
iMac4,2
iMac4,1
iMac,1
---------------------------------------------------
Mac mini
https://support.apple.com/en-us/HT201894
Exact regex: ^Mac14,(3|12)|Macmini[89],\d$
Current or higher regex: Not available
Supported:
Mac14,3
Mac14,12
Macmini9,1
Macmini8,1
Unsupported:
Macmini7,1
Macmini6,2
Macmini6,1
Macmini5,3
Macmini5,2
Macmini5,1
Macmini4,1
Macmini3,1
Macmini2,1
Macmini1,1
---------------------------------------------------
Mac Studio
https://support.apple.com/en-us/HT213073
Exact regex: ^Mac((13,\d)|(14,1(3|4)))$
Current or higher regex: Not available
Supported:
Mac14,14
Mac14,13
Mac13,2
Mac13,1
---------------------------------------------------
Mac Pro
https://support.apple.com/en-us/HT202888
Exact regex: ^Mac(Pro7,\d|14,8)$
Current or higher regex: Not available
Supported:
Mac14,8
MacPro7,1
Unsupported:
MacPro6,1
MacPro5,1
MacPro4,1
MacPro3,1
MacPro2,1
MacPro1,1
@timur-tabi
Copy link

timur-tabi commented Oct 30, 2023

You're missing entries for "MacBookX,Y" laptops.

@talkingmoose
Copy link
Author

@timur-tabi, I’m referencing Apple’s list of compatible Macs (see line 1). I only see MacBook Pro and MacBook Air models in the list. Can you point me to documentation on their site where they include MacBook models?

@timur-tabi
Copy link

timur-tabi commented Oct 30, 2023

I have a 2017 Macbook with the designation "Macbook10,1".

https://support.apple.com/en-us/HT201608

Update: I see now that perhaps the problem is that no "Macbook" laptops are compatible.

@talkingmoose
Copy link
Author

According to this article on MacRumors, macOS Sonoma doesn’t support this model MacBook, which corresponds to Apple’s website.

https://www.macrumors.com/2023/06/05/macos-sonoma-compatible-macs/

@atlauren
Copy link

atlauren commented Dec 4, 2023

M3 models are Mac15,\d
Exact regex update:
^(Mac(1[345]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment