How to create a Mountain Lion DMG image and load it into VirtualBox?

19
2014-04
  • user164187

    Basically, I just need to make a full copy of the Mountain Lion installer, but I have no flash, or any other removable medium available.

    Is it just possible to clone the system and mount the .dmg file on to virtualbox and install from there?

  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    How to mount encfs at login on OS X Mountain Lion
  • Jochen

    I'm using encfs to encrypt my dropbox contents and for that reason I'd like to have encfs mounted when users log in rather than at system startup. However, I can't make this work. I've tried:

    • Adding the mount command to .login/.profile. This doesn't work, because these scripts are executed when a shell starts up, not when the user logs in normally.
    • Adding a LoginHook to com.apple.loginwindow. This doesn't do anything except slow down my login process. There is nothing in the system log files, so I'm not sure how to debug this.
    • I took a look at /etc/fstab, but on Mountain Lion that file is empty, except for the warning that this file has no effect whatsoever, so adding anything to it won't help.

    For those not familiar with encfs, but familiar with getting stuff done on OSX, essentially what I have to run to mount the encrypted filesystem is this command:

    echo password | encfs -S encrypted_dir mount_point

    Any help at all appreciated.


  • Related Answers
  • Kyle Jones

    You can run any executable at login (including scripts) by adding it via System Preferences -> Users & Groups -> Login Items. Do not give the script an extension; use a name like foo not foo.sh. Since there's no associated window to display error messages if something goes wrong, I advise redirecting stdout and stderr into a file in /tmp.

  • ivanzoid

    The proper way to do this is to create a launchctl service. You won't have any Terminal windows open at login.

    Create a script /usr/local/bin/encfs-mount to load encfs with the arguments you desire. This would be similar to the script you're already loading. For example:

    #!/bin/bash
    /usr/local/bin/encfs -f --ondemand --extpass="security 2>&1 >/dev/null find-generic-password -gl encfs | grep password | cut -d \\\" -f 2" -i 15 ~/.sync ~/sync
    

    Note that the above script uses the OSX Keychain via the security command to provide the password, rather than saving it in this script. To add the password, open the Keychain Access tool, and add an application named encfs to one of your keychains. Use your login keychain if you never want to be prompted for the password, the System keychain if you want to be prompted for the encfs password every time it mounts the filesystem with --ondemand, or a new keychain if you want it to have its own password. See http://widerin.org/blog/secure-your-dropbox.

    Create a service file at ~/Library/LaunchAgents/com.arg0.encfs.plist to load that script. Replace YOUR_USERNAME with your username:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
       <key>Label</key>
       <string>com.arg0.encfs</string>
       <key>Program</key>
       <string>/usr/local/bin/encfs-mount</string>
       <key>KeepAlive</key>
       <true/>
       <key>UserName</key>
       <string>YOUR_USERNAME</string>
    </dict>
    </plist>
    

    Be sure encfs is not already running (if not, unmount and stop it). Then start the new service:

    launchctl load ~/Library/LaunchAgents/com.arg0.encfs.plist
    

    Your encfs filesystem should mount. Check /var/log/system.log to troubleshoot.