Why is AppleScript not ejecting my volume? I have a hard drive in my mac with multiple partitions, and I want to eject some of them with AppleScript. Simple:

tell application "Finder" 
    eject disk "Photos"
end tell


Except it does not work. I can eject the drive from Disk Utility no problem; here it is right after ejecting:



So the question is, how do I debug this situation — what could be going wrong?
I had the same issue. The Finder command eject seems to be unable to eject volumes although according to what I found on the internet it worked in times from 10.4 to 10.6.

The following script works. I have saved is as an Application in the Script Editor and have added it as a start object. Works well in my case.

tell application "Finder"
    set d to disk "Photos"

    if (exists d) then
        say "Disk exists"
    else
        say "Disk does not exist"
    end if
    if (d is local volume) then
        say "Disk is a local volume"
    else
        say "Disk is not a local volume"
    end if

    if (d is ejectable) then
        say "Disk is ejectable"
    else
        say "Disk is not ejectable"
    end if

    -- This fails because the disk is not ejectable
    eject d
end tell

-- Solution: Use Disk Utility directly
tell application "Terminal"
    do shell script "d=\"/Volumes/Photos\"; if [ -d \"$d\" ]; then diskutil eject $d; fi"
end tell