HomeHowTo › Stop iTunes From Launching When Using Media Keys

Stop iTunes From Launching When Using Media Keys

If you don’t use iTunes to play your music but an alternate media player (I recommend Cog) it might get very annoying that iTunes launches everytime you press your play/pause media key. There is a little but useful hack to stop iTunes from launching, simply by removing the x bit (that is the permission to execute). If you need to use iTunes again (to download stuff) you can simply re-set the x bit.

This can be done using chmod on the command line, or by creating a little app with AppleScript:

  1. Start the AppleScript Editor
  2. Paste the following source code:
    1
    2
    3
    4
    5
    6
    display dialog "Do you want to enable or disable iTunes?" buttons {"Enable", "Disable"} default button 1
    if button returned of result is "Disable" then
    do shell script "chmod -x /Applications/iTunes.app" with administrator privileges
    else
    do shell script "chmod +x /Applications/iTunes.app" with administrator privileges
    end if
  3. Translate the script
  4. Export it as an app

This is what the app will look like:itunes_switch_app
Source: M. Pitogo, https://discussions.apple.com/thread/2122639?start=15

5 Comments.[ Leave a comment ]

  1. Thanks a bunch!

  2. Thanks man, this helped a lot!

  3. hey there,
    quick question, how exactly do I undo this? Because now I can’t launch iTunes at all anymore. Sadly, I don’t really understand what you mean with “If you need to use iTunes again (to download stuff) you can simply re-set the x bit.”
    could you explain it to me like I am 5?

  4. Hey, I’ll try to explain it briefly:

    On Unix operating systems (and MacOS as it is based on Unix) there are several attributes saved along with each file to control the permissions. The main attributes would be r (read), w (write) and x (execute). You can see this as a triplet in which the attributes are either set or unset (i.e. “rwx” or “r-x” or “—“, …). Basically every file has three of these triplets. The first one sets the permissions for the file’s owner. The second one sets it for the file’s group and the third one for “everyone else”.

    So a file with all permissions set would have “rwxrwxrwx”. Or, for example, it could be “rwxr-x—” which would mean:

    – the owner of the file has “rwx”, thus he can do everything
    – users that are a member of the file’s group have “r-x”, so they can read and execute it
    – everyone else has “—” which means no permissions at all

    So if you remove the x attribute of iTunes.app (“chmod -x /Applications/iTunes.app” <-- this Terminal command will remove it from all three triplets) iTunes won't be executable anymore. You can add the x attribute again by typing "chmod +x /Applications/iTunes.app". You can find out the current permissions, owner and group of a file using the ls command in the Terminal. Enter "ls -al /Applications/ | grep iTunes.app" to get this information for iTunes. You should be able to fix your iTunes by typing "chmod 755 /Applications/iTunes.app" which sets the permissions to "rwxr-xr-x".

  5. Excellent, thank you very much! I got an error prompt when trying to start iTunes right after resetting x, but now its working again after a reboot.
    Learned something too! 🙂

Leave a Comment