How can I get a sound to play when I insert a specific USB key ?

Discussion in 'Mac Basics and Help' started by Neyiox, Jul 16, 2017.

  1. Neyiox macrumors newbie


    Jul 16, 2017
    Hi everyone,

    This is my first post on the forum and I would need some answers for a problem.

    Everything is in the title! I recently bought an USB key of BB-8 (Star Wars) and I would like to get a sound (that I already have) when I insert my key.

    I'm under Sierra 10.12.5

    Thank you in advance for your answers which I hope will help me.

    Good night!
  2. organicCPU, Jul 19, 2017
    Last edited: Jul 19, 2017

    organicCPU macrumors 6502a


    Aug 8, 2016
    AFAIK, there is no such easy solution on a Mac like writing an autorun.inf on Windows.
    Maybe better ask this at the programmers forum.

    I guess writing a Launch Daemon to watch the USB key insertion would be best practice over running some other kind of background app. Then you could involve an AppleScript or some other script to play the sound.

    A specific volume can be identified by its UUID. To get it, plug-in your USB key and type the following in Terminal with the proper name of your USB key
    diskutil info /Volumes/NameOfUSBDrive | grep UUID
    To get an idea for the Launch Daemon take a look here:

    For the AppleScript something like this could work:

    Edit: better than a third party sound app to play the sound is the use of built-in afplay

    Hope this helps to get the direction.
  3. Neyiox thread starter macrumors newbie


    Jul 16, 2017
    Thank you for your answer!

    I'm gonna check this even if I'm not an expert in code

Share This Page