The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

81

The best solution I've found today (2017) is to use Homebrew and Cask to install osxfuse and sshfs: brew cask install osxfuse brew install sshfs And then: sshfs username@hostname:/remote/directory/path /local/mount/point -ovolname=NAME It works! :-)


69

Use the open(1) command and a URL: open 'smb://username:password@server/share' Pros: Creates the mount point in /Volumes for you. Cons: Requires the Finder to be running.


55

I'd recommend checking if fsck is holding your disk hostage upon connection. This was it for me. Running ps aux | grep fsck revealed: root 2587 7.3 0.1 4363584 21780 ?? U 10:56PM 2:22.54 /System/Library/Filesystems/exfat.fs/Contents/Resources/./fsck_exfat -y /dev/rdisk2s1 So the solution was a sudo kill -9 2587 (insert your PID ...


26

The hdiutil command-line utility gives you more flexibility, and is extensively documented in man hdiutil. Something like this should do: hdiutil attach -mountpoint ~/myMountPoint mySparsebundle.dmg


26

All volumes, including DMGs, are mounted in /Volumes. You can get a list of mounted volumes by typing ls /Volumes in Terminal. You can navigate to a Disk Image using cd /Volumes/nameOfImage.


24

You want to run diskutil coreStorage unlockVolume <UUID>, where the UUID is the Logical Volume UUID associated with your encrypted disk, /dev/disk3. You can get the lvUUID by running diskutil cs list in the terminal and looking for the output related to /dev/disk3. The identifier is a long string that would look something like this 'B807C2A0-577F-...


21

For those encountering the same problem: hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount filename then mount it as you like. Source: https://serverfault.com/questions/174909/mount-block-file-on-osx


20

I use binchunker to convert .bin/.cue files to a single .iso file on my Mac. You can obtain binchunker via Homebrew or Macports. Here's some more info from the manpage: bchunk - CD image format conversion from bin/cue to iso/cdr SYNOPSIS bchunk [-v] [-p] [-r] [-w] [-s] <image.bin> <image.cue> <basename> DESCRIPTION bchunk ...


18

You need to use /dev/disk4 in place of just disk 4 in your command. It should read like this diskutil partitionDisk /dev/disk4 1 GPT HFS+ newdisk R


16

When using OS X, it's usually more advisable to use diskutil for disk-related activities. TL;DR: To mount a volume/disk by identifier: diskutil mount /dev/diskXsY # mounts just that volume diskutil mountDisk /dev/diskX # mounts the whole disk To mount a volume by UUID: diskutil mount [Volume/Partition UUID] To mount a volume by label: ...


16

The accepted answer only works when the NFS server allows connections on non-reserved ports (i.e. >1024). The exports man pages say it: exportfs understands the following export options: secure This option requires that requests originate on an Internet port less than IPPORT_RESERVED (1024). This option is on by default. To turn it off, specify ...


15

Try using mount -u -w: sudo mount -u -w /Volumes/YourDriveName -u modifies the status of an already mounted filesystem. -w mounts a filesystem as read-write.


13

From man diskutil: unmount | umount [force] device Unmount a single volume. Force will force-unmount the volume (less kind to any open files; see also umount (8)). unmountDisk | umountDisk [force] device Unmount an entire disk (all volumes). Force will force-unmount the volumes (less kind to any open files; see also umount (8)). ...


13

There are access control restrictions on that directory. You can inspect those from the command line: ls -lOe / (That's a capital letter O and not a zero 0) I would suggest mounting your volume to another directory - either /tmp or $TMPDIR rather than messing with the restrictions that are designed to prevent what you have - an actual directory with actual ...


13

As Apple replied to the ticket referenced in mattdwen's Open Radar link above, as of macOS Sierra 10.12, you can no longer create items in /Volumes unless root. Further, my best understanding of the AppleScript mount volume command is that it doesn't have a way to specify the mount point and consequently it only mounts volumes under /Volumes through the ...


11

The content type of the second partition is wrong. Instead of FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF it has to be 53746F72-6167-11AA-AA11-00306543ECAC. To edit the content type you have to boot to Internet Recovery Mode and use gpt. Additionally the fourth partition will be removed (probably the "deleted" partition). Please check that it doesn't contain any ...


11

The following is what I use to mount Samba shares via launchd: /usr/bin/osascript -e "try" -e "mount volume \"smb://guest@${host}\"" -e "end try" Using osascript's mount means any keychain access needed is done "automagically", there's no progress indicator or Finder window, and the command waits for the mount to be available before proceeding (try it with ...


10

I have spent quite a bit of time figuring out automounts of NFS shares in OS X... Somewhere along the line, Apple decided allowing mounts directly into /Volumes should not be possible: /etc/auto_master (see last line): # # Automounter master map # +auto_master # Use directory service /net -hosts -nobrowse,hidefromfinder,nosuid /home ...


10

There is an update from Apple. When connecting to a server that requires a user name and password, macOS Sierra 10.12 or later asks you to click Connect, even when the name and password have been saved in your keychain. This helps you to avoid transmitting login credentials to a server you didn't intend to connect to. If you want to disable this ...


10

In Finder, press cmd + k and enter the path to the NFS server/share: For me this mounted as /Volumes/users-1 (but I already had /Volumes/Users mounted). iMac21:~ user$ df -h /Volumes/users-1 Filesystem Size Used Avail Capacity iused ifree %iused Mounted on 192.168.7.5:/nas/users 5.4Ti 4.8Ti 292Gi 95% 261121 366027775 0% /...


9

This applescript will close them for you. Paste it into Script Editor and then Save as an application. Then grant access to that application in (System Preferences > Security & Privacy > Accessibility) Then you can use an application like ControlPlane https://www.controlplaneapp.com/ to run the application on wake thus closing them all automatically! ** ...


9

You can use hdiutil to mount a disk image that is protected with a passphrase. hdiutil attach -agentpass /path/to/image.dmg That should attempt to mount the disk image, prompting you for the passphrase. If it's encrypted with a public key, you can pass that using option -pubkey.


9

Try with DAEMON Tools Lite for Mac, you can download here: http://www.daemon-tools.cc/products/dtMacLite This software has figured out how to trick the computer to thinking a DVD is mounted and I don't know if you can re-implement it via the command line tool vndevice you mentioned.


9

Sometimes symbolic links may not be suitable for your needs. In that cases you can use bindfs - a FUSE filesystem for mounting a directory to another location. Install it with homebrew: brew install bindfs And then bind one folder to another: bindfs /Volumes/Data/ContentA ~/ContentA


9

As mentioned by another user on StackOverflow, you can use an NFS mount do to this. However, it requires a little bit of one-time setup. First, you'll need to set up an /etc/exports file (if you haven't done so already). $ sudo tee -a /etc/exports <<< "/ -alldirs -mapall=$USER localhost" Secondly, you'll need to start the rpc and nfsd services. $...


9

In Terminal type, man mount and press enter. It says: The system maintains a list of currently mounted file systems. If no arguments are given to mount, this list is printed. So, in Terminal type, mount and press enter.


9

Set an entry in /etc/fstab as directed here. To summarize. Open Disk Utility, unmount the relevant volume. Click on the volume you're trying to mount, and click the "info" button. Note down the drive's File System UUID, which should look something like 5E85BA88-7C74-34A9-8CE6-267C752CE2BA. I'm just gonna use 123abc as shorthand for it. Open up /etc/fstab ...


8

Use HomeBrew to install fuse4x and sshfs The commands to install are: brew install sshfs when you run it, it gives two other commands that I needed to run in order to install the fuse4x kernel extension. Run them. Then, to mount the ssh filesystem mkdir ~/mymountdir sshfs username@hostname:/home/thedir ~/mymountdir it will ask you for your password.


8

You should be able to use Disk Arbitrator to do most of what you want. Certainly requirement 1 is met and you should be able to achieve most of 2 with it too.


Only top voted, non community-wiki answers of a minimum length are eligible