It's available from the IDE's board manager. Exactly where depends on which version of the IDE you're using. With v1.8.x it's Tools --> Board --> Board Manager
Also, which board have you selected to compile for? Again with With v1.8.x it's Tools --> Board
The following minimalist code compiles for me with ESP32 Core v3.1.1 which is fairly recent.
#include <WiFi.h>
#include <esp_mac.h>
void setup() {
uint8_t baseMac[6];
esp_read_mac(baseMac, ESP_MAC_WIFI_STA);
}
void loop() {
}