Apple Mount Dmg As Root

Apple Mount Dmg As Root Average ratng: 5,7/10 5240 votes

An AppleScript to mount, run, unmount a disk image 20 comments Create New Account
Click here to return to the 'An AppleScript to mount, run, unmount a disk image' hint

Dec 17, 2011  Mount a DMG from the Command Line in Mac OS X Dec 17, 2011 - 14 Comments A helpful command line tool called hdiutil is included in Mac OS X that allows disk image files (.dmg extension) to be mounted directly from the Terminal, without the need of using the GUI. Nov 27, 2017 When you're logged in to your Mac using an administrator account, you can use the sudo command in the Terminal app to execute commands as a different user, such as the root user. After you enter the command, Terminal asks you to enter your account password. Sep 25, 2012  Sometimes you may want to download and mount DMG file using Mac OS command line, and in this post I'll show you how to do it. Why would you want to mount DMG files manually? I've been business traveling quite a bit lately which means I'm most of the time away from my home computer. Hi all, Anyone know how/if I can use the above script to mount and then unmount physical firewire drives? I have a couple of external disks: one holds all my photos, mp3s, movies, audio etc, the other is the backup drive to which Backup 2 rights to when backing up my system. Sep 23, 2016  I've tried doing a clean install of Sierra multiple times, and every time, the installer gets to the end and then shows the message 'The installer payload failed signature check'. This leaves the computer without a bootable version of macOS. I have tried recreating the. But then, all you get is a f. stupid useless.dmg file you cannot handle. No Wallpaper, No icons - NOTHING!!! Well, don't worry. You actually can open it with Linux (as we know, there's nothing this OS can't do:).dmg are Disk Images of the Apple FS HFS - nothing more, nothing less. And you can mount this as any Disk image =).

The following comments are owned by whoever posted them. This site is not responsible for what they say.

Apr 11, 2018  Apple launched macOS High Sierra in Fall 2017 and with it brought a new challenge: the new Apple File System (APFS). How to mount a physical image of macOS 10.13 High Sierra on a Mac. The command below will mount a disk image (DMG.

An AppleScript to mount, run, unmount a disk image
hehe, *proud* (of the very little I did to make to whole thing function) By the way, is the necessay? I would think a simple with or without the -force, should be able to unmount and detach the whole disk. However, I stand by 'If it ain't broke, don't fix it' (unless it hogs the CPU while functioning) Dale Mox
An AppleScript to mount, run, unmount a disk image

What Dale says (and thanks again, Dale!) *should* be right, but OS X seems to have some obscure bugs that prevent it from doing the right thing every time it should.
If I remove the line that Dale mentioned, the script works two or three time - but then, the next time, it launches the application, and the application complains that the disk image is not available - even though it's right there on the desktop. And then the script won't work again (I mean the application won't see the disk image again) until a reboot.
When I include the unmount AND the detach lines, the script continues to work correctly even when I run it ten times - which is the most I've tried so far.
As Dale says, the script is a bit of a CPU hog when it's unmounting and detaching, but this is probably better than waiting through the reboot that seems to be required after it fails. But maybe future versions of OS X won't require all this extra work..

An AppleScript to mount, run, unmount a disk image

Thanks a bootload for this script!
I had hacked up another older script I found here to set up a SSH tunnel and mount an encrypted sparseimage before opening Mail. It worked well except if I didn't enter my password on the sparseimage mount fast enough, it would lock up.
This one is patient enough to wait.
Scripts like this are the reason I love this site!

Vlc 0.9 10 dmg. Note: VLC's nightly builds require at least macOS 10.7 for VLC 3.0.x (stable version) or macOS 10.11 for VLC 4.0.0 (development version)It will not launch on older releases. This will also improve your VLC usage experience.Note that nightly builds for macOS are not signed with our GateKeeper certificate. Therefore, you need to right-click on the application to select Open to launch them for the first time after download. We recommend you to keep your Mac OS X installation up-to-date and to install Apple's updates.

An AppleScript to mount, run, unmount a disk image
I achieve basically the same results with the following code:
An AppleScript to mount, run, unmount a disk image

One problem:
This will only eject disks that are visible in the desktop view. I have set the name of my mail volume to '.Mail' to keep it off of my desktop, but still have all other mounted images show up. Whenever I try to eject the volume using Finder's 'eject' command, it says it can't find the volume, although it is in the disk list.
Any ideas on how to make the finder eject hidden volumes?

An AppleScript to mount, run, unmount a disk image

The script at the top of this story (the original hint) ejects hidden disks because it doesn't use the finder to mount or unmount them - it uses shell scripts.

An AppleScript to mount, run, unmount a disk image

I should have clarified that I was commenting on Christian Leue's script and not on the original script. Sorry!

An AppleScript to mount, run, unmount a disk image

Hi all,
Anyone know how/if I can use the above script to mount and then unmount physical firewire drives?
I have a couple of external disks: one holds all my photos, mp3s, movies, audio etc, the other is the backup drive to which Backup 2 rights to when backing up my system.
I week or so ago, I discovered that iTunes had somehow found the backed up library and was using that as the default. To stop this is generally eject the backup drive off the desktop, but of course, I have to remember to mount it again before backup 2 runs. I forget quite often!
I'd like to do this automatically if possible.
Stuart

An AppleScript to mount, run, unmount a disk image

This would be a more significant issue with iTunes configuration and should probably be addressed as such. I suspect that you did a search for music since backing up and iTunes found your backup on top of your regular source.

What you should do to fix the problem is the following:

  1. Download and install this script from Doug's Applescripts for iTunes (Super Remove Dead Tracks).
  2. Under 'Advanced' tab in iTunes Preferences, verify that 'iTunes Music folder location' is set to where you want to keep your music. Usually, having the 'Copy files to iTunes Music folder when adding to library' turned on is a good idea as well, but it isn't necessary.
  3. Verify that your original folder has all of the music.
  4. Temporarily unmount your Backup2 drive
  5. Run the Super Remove Dead Tracks script in iTunes.

That should remove any references to the new folder. Note that the script only removes the references from the iTunes library and not the files (at least last time I used it) so it should be safe to run once the volume is unmounted.

If the music is not in your library, try consolidating your music after step 2 above (in iTunes, use 'Consolidate Library..' under 'Advanced' menu) and then you may want to check for duplicate songs using another script from Doug's site.

An AppleScript to mount, run, unmount a disk image

I used the ideas from your script and just did
tell application 'Finder'
try
open item 'Macintosh HD:applications:images:CalculatingCrew.dmg'
end try
repeat until name of every disk contains 'Crew'
delay 1
end repeat
open item 'Crew:Calculating Crew'
end tell
and it works great - for MOST applications. But some mount the image and then say that 'the CD can't be found. Please insert it and try again.'
Can anyone help me with this problem? Thanks!

An AppleScript to mount, run, unmount a disk image

In reply to mmatties's question: the problem you came across (the app can't find the image) is EXACTLY what the script in the hint is designed to fix. It fixes the problem by NOT using the Finder to mount the disk, but by using a shell script. Try the script in the hint itself and see whether it solves the problem for you. (But reboot first, because after the application can't find the image, it will never see it again until you reboot.)

An AppleScript to mount, run, unmount a disk image

A more flexible perl solution, in case you have multiple mounts, in multiple locations. Also remote friendly
[code]
#!/usr/bin/perl
$command=$ARGV[0];
$name=$ARGV[1];
### Add your disk image name, and location here
%directories=('all','~/Desktop/all.dmg','none','~/Desktop/none.dmg');
if($command eq 'mount')
{ system 'hdiutil mount $directories{$name}'; }
elsif($command eq 'unmount')
{
$mount_data = `mount`;
($dev)=($mount_data=~/(/dev/diskd{1,2}).*?/Volumes/$name/);
system 'hdiutil detach $dev';
}
else
{ print 'sorry, must select mount or unmount';}
[/code]
Save as diskmnt.pl, make it executible by running chmod a+x diskmnt.pl, then dump it into /usr/local/bin
Works great for me, and is a bit more compact and easier for a command line guy like me to understand.
Any thoughts suggestions, let me know
cheers
-rick

Apple Mount Dmg As Root Download

An AppleScript to mount, run, unmount a disk image

Re: rattler14's script -
Handy, thanks. However, a few comments/questions:
1) When I tried to put the file in /usr/local/bin/ is gave me a permissions error and I had to login as root to place it. Is that normal?
2) Being a bit of a *nix newbie is there any other command to run it than:
/usr/local/bin/diskmnt.pl ? Maybe my path needs updating?
3) I would like to use this ( or something like it ) to unmount one of my main drive's three partitions. Is that possible? Currently when I run it, it unmounts both of the non-running partitions.
Thanks for your time and help in these matters.

An AppleScript to mount, run, unmount a disk image
It doesn't look like the script will unmount correctly if the mounted image name contains a space. The first 'hdiutil unmount..' fails because it thinks you're trying to pass it two different image names.
Any idea what the proper syntax is to work around this?
Relevant bits:
An AppleScript to mount, run, unmount a disk image

The solution to oshea's question seems to be something like this:
If you need to mount a disk image whose name in the Finder has a space or ampersand or other non-alphanumeric character, then you probably need to use two different variables instead of the one 'diskname' variable in the original script.
The variable diskname should be the name in the Finder, as in the original script, and this should be used in the pure-Applescript parts of the script (the parts that don't use shell scripts).
Another variable would be called something like unixdiskname, and this would use escaped characters, like this:
unixdiskname: 'Nemo UMF'
or
unixdiskname: 'This & That'
Then, in the original script's shell script commands, replace 'diskname' with 'unixdiskname'. I haven't tested this enough to be certain it works, but I think it will.

An AppleScript to mount, run, unmount a disk image
I tried your suggestion for escaping the spaces and ScriptEditor gave me an error. The script line: was diagnosed with the error: Could you (or somebody else) give me a way around this issue?

Kevin O'Shea pointed out (in a private message) that the original script can be speeded up by modifying the shell script with 'hdiutil attach' - just add the -noverify switch at the end of the shell script, so that the last bit in quotation marks reads:
' -mount required -noverify'
Seems to work for me.

An AppleScript to mount, run, unmount a disk image
I tried to get the AppleScript working. I could get the disk image to mount and the application to start but after the application quit the disk image was still mounted. I came up with a different solution that works pretty well for my needs. What I wanted was a way to avoid having my children handle CDs and launching applications. To solve this problem I built bootstrap AppleScript application icon and name set to be the same as the program that it ultimately launches. The AppleScript application calls a the mntrun shell script that adds canned, location-specific text to the application and disk image names then mntrun calls the script that does the real work, mntlauncher. Mntlauncher mounts the disk drive image, starts the application, waits for the application to finish, then unmounts the disk image. Here's the AppleScript that launches 'Reader Rabbit's Toddler': Here's the text of /Applications/Launchers/mntrun: Here's the text of /Applications/Launchers/mntlaunch: In mntrun you can see the script is designed for applications to be located in the /Applications folder. The AppleScript application merely needs to make reference to the application path relative to /Applications. In mntrun you can also see that I keep my disk images in /Volumes/160GB HD/CD Cache/Educational/originals, so mntrun creates the proper full path name to the disk image for mntlaunch. If the user wishes to run an application on the mount volume one merely needs to refer to an application path such as './Volumes/Volume Name/Application Path'. The './Volumes/Volume Name' is the path to the mounted volume and 'Application Path' is the path to the application within the mounted volume. It's all quite a hack, but at least I can stop having to make CD copies for my children (3 and 6 years old)!
An AppleScript to mount, run, unmount a disk image

The reason for this is that there are two layers of escaping needed. 1) Applescript uses the character to escape things in any string; and 2) the shell itself uses to escape things.
So, when inside a string Applescript sees the character, it wants the next character to be a valid escape character. You actually want a literal in the string (so that the shell will see it, and treat is as an escape character).
property unixdiskname : 'Reader Rabbit Toddler'
will do the trick for you.

An AppleScript to mount, run, unmount a disk image
That was supposed to be a reply to this thread of comments earlier on the page.

DMG files are proprietary disk image files used for software distribution in Mac OS. Providiing both password protection and bzip2-like compression, these files are perfect packaging medium.

Usually DMG files are opened automatically when you click them in Finder. They appear as a folder with files, but actually Finder mounts each DMG file as a separate filesystem and then shows you its contents. If you're observant enough, you'll see that in the left side panell of Finder you have all the active DMG filesystems listed and ready to be ejected once you finish copying the files or installing new software.

Sometimes you may want to download and mount DMG file using Mac OS command line, and in this post I'll show you how to do it

Why would you want to mount DMG files manually?

I've been business traveling quite a bit lately which means I'm most of the time away from my home computer. Naturally, I have configured Remote Desktop access so that I can use my iPad to access my desktop whenever I need, but sometimes it takes forever to do some simple things just because of the graphics environment overhead.

If you're like me, you'll probably find Remote Desktop over 3G to be pretty boring, and will want to do as much as you can via command line.

Apple Mount Dmg As Root Canal

Mounting DMG with hdiutil command

In order to manually mount DMG file, you'll need to use hdiutil command. You don't have to be a privileged user, so can do it as your own user.

For this example, I'm going to use the command line interface (CLI) for the excellent HandBrake tool, which is great for converting all sorts of videos into iPad and iPhone friendly resolution and mp4 format

Apple Mount Dmg As Root 2

Mount

Let's mount the image from my dmg file:

Apple Mount Dmg As Root Download

As you can see from this output, the mount was successful and you now have the filesystem from DMG package available under the /Volumes/HandBrake-0.9.8-MacOSX.6_CLI_x86__64 directory.

Don't want to to take my word for it? Let's use the standard mount command to confirm that indeed we now have an new filesystem mounted:

Ejecting mounted DMG images from command line

Once you are done with whatever you were trying to do, there's no longer a reason to keep your DMG image mounted, so you should unmount it. While it's possible to use umount command, I think it makes more sense if you use the same hdiutil tool that helped you mouunt the DMG image in the first place.

Here's how you can eject the DMG image using hdiutil:

Apple Mount Dmg As Root System

That's it for today, hope you liked the post! Let me know!