You need to complete a Pharm D degree which is 4 years.
In order to be admitted to the program, you need to fulfill the pre-reqs. That can take as little as one year. However, some students keep getting their applications rejected. So they complete a Bachelor's first.
After finishing the Pharm D, you can do one or two more years of residency. At this point it is optional.