adjust order and add brew package check and install function