Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

calvin123

macrumors newbie
Original poster
Jan 5, 2017
5
0
Keep receiving the following message:
hdiutil: convert: only a single input file can be specified
Usage: hdiutil convert -format <format> -o <outfile> [options] <image>
hdiutil convert -help

I am entering the following into the terminal, where am I going wrong?

hdiutil convert -format UDRW -o ~/Users/calvin/Local Documents2/arch2.img ~/Users/calvin/Local Documents1/arch123.iso

All responses are appreciated.
 
You have to escape the spaces in the file path.

Either do this:
Code:
hdiutil convert -format UDRW -o /Users/calvin/Local\ Documents2/arch2.img /Users/calvin/Local\ Documents1/arch123.iso

Or this:
Code:
hdiutil convert -format UDRW -o "/Users/calvin/Local Documents2/arch2.img" "/Users/calvin/Local Documents1/arch123.iso"
 
Last edited:
You have to escape the spaces in the file path.

Either do this:
Code:
hdiutil convert -format UDRW -o ~/Users/calvin/Local\ Documents2/arch2.img ~/Users/calvin/Local\ Documents1/arch123.iso

Or this:
Code:
hdiutil convert -format UDRW -o "~/Users/calvin/Local Documents2/arch2.img" "~/Users/calvin/Local Documents1/arch123.iso"
1. An absolute pathname should not start with ~/.
2. A ~/ must be outside the quotes, or the shell won't expand it.

Compare the outputs of:
Code:
echo ~/
echo "~/"
 
Hi guys thanks for the fast responses, getting rid of the spaces seemed to do it (I think that was the reason or was it something else newbie to Mac).

This is what I entered for it to work:
hdiutil convert -format UDRW -o /Users/calvin/LocalDocuments2/arch2.img /Users/calvin/LocalDocuments1/arch123.iso

If the spaces was the problem could someone please explain why?
 
Last edited:
1. An absolute pathname should not start with ~/.
2. A ~/ must be outside the quotes, or the shell won't expand it.

Compare the outputs of:
Code:
echo ~/
echo "~/"

Good catch, I actually did not even pay attention to this once I saw the space, and just copied the path as is.

If the spaces was the problem could someone please explain why?

Bash interprets spaces as delimiters of parameters. Suppose you only added the first file path to the command, then Bash would have interpreted it was two file paths and would have accepted the command. It obviously would eventually also fail, as the paths are not correct.

You should get used to dragging and dropping files into Terminal directly or using tab completion. When you start typing a path and press tab once, Terminal will attempt to complete the path for you as far as it can before any disambiguation. You can press tab twice to see how you can branch off in case of multiple possible paths.
 
Last edited:
Ah sweet, so if just for some reason I wanted 2 copies of the .img file and had 2 directories names 1:Local 2:Documents2 and entered the following as my output /Users/calvin/Local Documents2/arch2.img would this have worked?

Also when in finder is there a shortcut for going up a directory?
Many thanks for your help!

Not sure why it has given the green smiley but should be 2: Documents2
 
If the spaces was the problem could someone please explain why?
Spaces were part of the problem but your path was also incorrect:
Code:
~/Users/calvin/Local Documents2/arch2.img
Ignoring the space for the moment, the ~ in the front of the path indicates the current user's home folder, so what you typed is actually translated as the following by the computer (again ignoring the space for the moment) :
Code:
/Users/calvin/Users/calvin/Local Documents2/arch2.img
You'd either want to use /Users/calvin or the ~ but not both. Using the ~ can have some complications as shown above in post #3. You can never go wrong with using the actual full path instead of ~ for files in your home folder.
Another helpful tip is that you can enter the command, in this case the
Code:
hdiutil convert -format UDRW -o
and then press space and drag the original file into the terminal window. This will show you the syntax and path the terminal is expecting so that you can enter something that'll be correct for your output file.
 
  • Like
Reactions: calvin123
Thank you very much chrtr I think you have cleared it all up for me, makes much more sense now. Is there a useful website containing information like this that you think might be of help?
 
Last edited:
Ah sweet, so if just for some reason I wanted 2 copies of the .img file and had 2 directories names 1:Local 2:Documents2 and entered the following as my output /Users/calvin/Local Documents2/arch2.img would this have worked?

No. ;)

You have to check the synopsis of the command to see whether it supports this. hdiutil does not:
Code:
hdiutil convert image -format format -o outfile

It expects all of the things that are not within brackets. If you were allowed to specify multiple input files, it would have marked this with an ellipsis, such as this:
Code:
hdiutil convert image ... -format format -o outfile
 
  • Like
Reactions: calvin123
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.