Age-at-onset is one of the critical phenotypes in cohort studies of age-related diseases. Large-scale genome-wide association studies (GWAS) of age-at-onset can provide more insights into genetic effects on disease progression, and transitions between different stages. Moreover, proportional hazards or Cox regression generally achieves higher statistical power in a cohort study than a binary trait using logistic regression. Although mixed-effects models are widely used in GWAS to correct for population stratification and family structure, application of Cox mixed-effects models (CMEMs) to large-scale GWAS are so far hindered by intractable computational intensity. In this work, we propose COXMEG, an efficient R package for conducting GWAS of age-at-onset using CMEMs. COXMEG introduces fast estimation algorithms for general sparse relatedness matrices including but not limited to block-diagonal pedigree-based matrices. COXMEG also introduces a fast and powerful score test for fully dense relatedness matrices, accounting for both population stratification and family structure. In addition, COXMEG handles positive semidefinite relatedness matrices, which are common in twin and family studies. Our simulation studies suggest that COXMEG, depending on the structure of the relatedness matrix, is 100~100,000-fold computationally more efficient for GWAS than coxme for a sample consisting of 1000-10,000 individuals. We found that using sparse approximation of relatedness matrices yielded highly comparable performance in controlling false positives and statistical power for an ethnically homogeneous family-based sample. When applying COXMEG to a NIA-LOADFS sample with 3456 Caucasians, we identified the APOE4 variant with strong statistical power (p=1e-101), far more significant than previous studies using a transformed variable and a marginal Cox model. When investigating a multi-ethnic NIA-LOADFS sample including 3456 Caucasians and 287 African Americans, we identified a novel SNP rs36051450 (p=2e-9) near GRAMD1B, the minor allele of which significantly reduced the hazards of AD in both genders. Our results demonstrated that COXMEG greatly facilitates the application of CMEMs in GWAS of age-at-onset phenotypes.