Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using Mac OS X 10.6.4 and am struggling with the command:

diskutil

Whenever I type in diskutil the terminal says:

-bash: diskutil: command not found

Does anyone know what the problem might be? Can I install the diskutil script (probably by copying some *.sh to some destination and adding something to the bash.profile)?

share|improve this question

3 Answers 3

diskutil is a system administrator command. That's why it's not in the default search path for ordinary users.

The usual way to run it is to run sudo diskutil. The sudo command runs a command as the system administrator (root). sudo searches for the command in a different search path (it sets the PATH environment variable to a diffent value before searching for the command name), which includes /usr/sbin where system administrator commands such as diskutil reside.

If you do want to run diskutil as your ordinary user, specify the full path: /usr/sbin/diskutil.

share|improve this answer
    
While this is almost true, there are a few things you can do as a non-root user, list partitions, view the information on a mount point, etc. Basically the same stuff you can do inside of Disk Utility without unlocking it. Anything that actually presents a risk to data on disk will require root privs. –  peelman Nov 20 '10 at 16:14
1  
Actually, this answer is wrong on a couple of counts: first, OS X keeps sudo is in /usr/bin, not sbin; second, /sbin and /usr/sbin are in the default PATH for standard users as well as admins. –  Gordon Davisson Nov 20 '10 at 17:18
    
OSX Mavericks, and /usr/sbin/diskutil isn't there. –  OrangeDog Mar 12 at 11:02
    
@OrangeDog Oh, do you know where it is? I don't have access to any OSX machine. Is diskutil on the default path? –  Gilles Mar 12 at 11:55
    
@GordonDavisson This answer claims nothing about where sudo is. Evidently /usr/sbin (which is where diskutil was in OSX at the time) wasn't in Maccaius's PATH; was /usr/sbin in the default PATH in 10.6.4? –  Gilles Mar 12 at 11:58

Use:

/usr/sbin/diskutil

instead of just:

diskutil
share|improve this answer

Check your PATH (echo $PATH). diskutil is in /usr/sbin. Add it to your path if it isn't already there. If it is, then yes, diskutil is missing. (/usr/sbin/diskutil is an executable itself, not a shell script.)

share|improve this answer
    
could you tell me then line to add to the bash.profile in order to include /sbin/ ? –  Maccaius Nov 20 '10 at 13:29
    
/usr/sbin doesn't belong in your ordinary users path, see Giles' answer. –  SvW Nov 20 '10 at 13:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.