Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a script that reads data from

/Volumes/somenetworkdir/...

Each time run it, I have to open Finder and navigate to the relevant network share in order to make OSX mount the volume. Is there a way to get OSX to mount the network volume automatically from a script? Any language is fine, as is a shell command. I guess applescript will be a candidate...

share|improve this question

1 Answer 1

up vote 5 down vote accepted

You could use the mount command. It supports several network share formats.

This is for a samba (Windows) share

sudo mount -t smbfs -o username=RemoteUser //REMOTEHOST/directory /Volumes/somenetworkdir

man mount in a terminal will show you the full list of options.

Since this depends on a script, you could include this call prior to accessing that share.

If this is a share you are not always on a network which is permitted to connect to it, have a look at ControlPlane. It will let you run something when on a certain network, so you could mount this share whenever you connect to this shares network.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.