The present application relates to a macrocycle containing aminopyrazole andpyrimidine, which is represented by formula (I), a pharmaceutical compositionthereof, anda use thereof in inhibiting tropomyosin receptor kinase (Trk) activity and intreatingdiseases in mammals that are mediated by Trk.(see formula I)