I am looking for any kind tips or libraries that would allow me to mount an SMB share from within Swift. I looked into AMSMB2, but it doesn't actually mount the share, it just connects to it. I have also looked into invoking a bash script from Swift that uses mount_smbfs, which has been closest to what I need.

The NetFS library does seem to have the matching functionality, but I can't find any documentation for it provided by Apple. I tried to wing it without any documentation, but the functions aren't very verbal about what is wrong, which is why I'm seeing if there is anything else out there.

Has anyone every tried using SMB with a Swift application?

2 Answers 2


Visuality Systems has a commercial licensed solution called YNQ (written in C) that you can integrate to your application.

If you want to mount a share using a driver this won't help, but if you want to use the mount point provided by the YNQ and then do all the operations you wants this illustration for you.


I know this is question is a little old but I thought I'd respond in case someone else stumbles over this.

I have a simple little app (Mounting Yard - https://github.com/dagronf/MountingYard) which can mount smb drives via NetFSMountURLAsync in Swift. Unfortunately as you've mentioned the online documentation is almost non-existent and I've had to cobble this together from multiple sources but it seems to work okay.

You can see the NetFS call here :-


This code doesn't automatically handle passwords (I didn't want to store passwords in my app) however the NetFSMountURLAsync call can handle it.

Hope this is useful!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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