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

grxgghxrpxr

macrumors newbie
Original poster
May 15, 2021
8
0
Hello.

I have a tech YouTube channel and I'm currently creating a tutorial on how to create a macOS disk image. I realised I don't have enough space to convert a .dmg file to a .cdr file after creating the empty disk image. So, I am trying to delete the empty disk image as it has just created lots of purgeable space on my SSD. I can't find it and don't know how to delete it (I have restarted my MacBook since deleting it).



Here is the command I used to create the empty disk image: 'sudo hdiutil create -o /tmp/BigSur -size 15360m -volname BigSur -layout SPUD -fs HFS+J’.



Thanks

Gregg
 

chabig

macrumors G4
Sep 6, 2002
11,445
9,317
Creating disk images is so much easier with the GUI in Disk Utility. I know that doesn't answer your question. Look in /tmp/BigSur/
 
Last edited:

grxgghxrpxr

macrumors newbie
Original poster
May 15, 2021
8
0
It says there's no such file or directory. I'm honestly baffled, because the file has been deleted, but the purgeable space is still there.
 

Slartibart

macrumors 68040
Aug 19, 2020
3,142
2,817
What version of MacOS(X) are you running?

Can you kindly check in the terminal with

echo $TMPDIR

where your system is storing temporary files?

Or you just open this directory directly from the terminal using

open $TMPDIR

Notably, $TMPDIR is not protected by System Integrity Protection (meaning whether SIP is enabled or not you can still modify, edit, delete, and write to that directory), so be cautious as many files and items in the $TMPDIR will be actively used by currently open applications. Within $TMPDIR you’ll find all sorts of media caches and other files. As mentioned before, do not manually modify or delete anything in these directories unless you know exactly what you’re doing.

Then again you specified /tmp in you shell command. For what it’s worth, /tmp in Mac OS actually just links to /private/tmp/ , so you can also just navigate to /private/tmp/ to find the same data, whether it’s a bunch of caches, etc.

The primary user temporary folder is located at:

~/Library/Caches/TemporaryItems/

There are also various user level temporary folders, like ~/Library/Caches/

As already mentioned, you should probably not attempt to delete or modify anything in the temp folders, no matter where they are, whether it’s in your user folder or $TMPDIR or elsewhere, as you can easily screw something up or end up with unintended results. But this should help location the image you have written.

If for whatever reason you are concerned about the $TMPDIR contents or other similar type of files and data, simply quitting all open apps, then restarting the Mac will clear out temporary items from /private/var/ folders and much of what’s found in $TMPDIR as well.
 

grxgghxrpxr

macrumors newbie
Original poster
May 15, 2021
8
0
What version of MacOS(X) are you running?

Can you kindly check in the terminal with

echo $TMPDIR

where your system is storing temporary files?

Or you just open this directory directly from the terminal using

open $TMPDIR

Notably, $TMPDIR is not protected by System Integrity Protection (meaning whether SIP is enabled or not you can still modify, edit, delete, and write to that directory), so be cautious as many files and items in the $TMPDIR will be actively used by currently open applications. Within $TMPDIR you’ll find all sorts of media caches and other files. As mentioned before, do not manually modify or delete anything in these directories unless you know exactly what you’re doing.

Then again you specified /tmp in you shell command. For what it’s worth, /tmp in Mac OS actually just links to /private/tmp/ , so you can also just navigate to /private/tmp/ to find the same data, whether it’s a bunch of caches, etc.

The primary user temporary folder is located at:

~/Library/Caches/TemporaryItems/

There are also various user level temporary folders, like ~/Library/Caches/

As already mentioned, you should probably not attempt to delete or modify anything in the temp folders, no matter where they are, whether it’s in your user folder or $TMPDIR or elsewhere, as you can easily screw something up or end up with unintended results. But this should help location the image you have written.

If for whatever reason you are concerned about the $TMPDIR contents or other similar type of files and data, simply quitting all open apps, then restarting the Mac will clear out temporary items from /private/var/ folders and much of what’s found in $TMPDIR as well.
It's not in there either, I've closed all apps & restarted several times and the .dmg file isn't there, yet the purgeable space is. I'm running Catalina.
 

bogdanw

macrumors 603
Mar 10, 2009
6,116
3,025
I'm currently creating a tutorial on how to create a macOS disk image.
sudo hdiutil create -o /tmp/BigSur -size 15360m -volname BigSur -layout SPUD -fs HFS+J’.
Before creating tutorials for others, you should learn that there is no need to use sudo for such a purpose, nor it is a good idea to use /private/tmp when you can use any folder under the user account. To remove the dmg using Terminal, try sudo rm /private/tmp/BigSur.dmg
ls -al /tmp should give this reply in Catalina /tmp -> private/tmp
ls -al /private/tmp should list the contents of the folder where your command created the dmg
 
  • Like
Reactions: chabig

Slartibart

macrumors 68040
Aug 19, 2020
3,142
2,817
It's not in there either, I've closed all apps & restarted several times and the .dmg file isn't there, yet the purgeable space is. I'm running Catalina.
Only system written temporary file will be purged automatically. I’m not sure about Catalina, but your shell command does not produce a file with an extension like “.dmg”

Try find / BigSur in the terminal. You can use ls -alhS to get the size of the files in the tmp-folders.

Or you

  1. Open Finder.
  2. Find the Search field in the top right and click it.
  3. Click the Settings symbol and select Show Search Criteria.
  4. In the list of search filters on the left, choose Other.
  5. In the window that appears, select File Size and click OK.
    laof1_1572529660.png
    In the second space, select Is greater than and enter the size in the third space.
  6. Choose KB, MB, or GB in a final filter field.
EDIT: the find command can easily extended with the wildcards * or ?
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.