I'm not sure if this is possible.
I have an encrypted partition on a USB drive, when I mount it I want to run a script in iTerm2 or Terminal app.
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
Im not certain it will work for this, but I would suggest looking into AppleScript. I know you can use it to run Terminal commands, but I don't know if there is a way to detect when A flash drive is mounted.