Macos – diskutil command not found in OS X terminal

bashdisk-utilitymacosterminal

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)?

Best Answer

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.