UPDATE – I’ve found a much better fix – Use NFS shares instead- Use NFS shares instead of Samba with XBMC
Well it’s been a nightmare few days with the upgrade to Lion GM breaking Samba sharing. For me NFS isnt really an option, it’s clunky, and my network is full of old windows machines, not to mention the XBMC’s on the Apple TV 2, Ipad 2, iPhone and the old Xboxs. i needed a fix for Samba, and this came in the form of installing Samba 3 on Lion via Macports and setting up the smb.conf file manually to share my media.
This text is partly my own work and partly complied from other tutorials.
You will need a copy of Lion GM installed on your mac, along with a copy of xcode 4.1 (available from a lot of places, legitimate or otherwise). You will then also install first macports and then samba 3 via terminal, but most of this stuff is copy & paste. Finally, I’d install a copy of Textwrangler for mac. It will let you edit files in its text editor without using the command line, which is much easier, and will let you unlock & authenticate to save/open files anywhere in the filesystem.
First, install Xcode 4.1 (DP7 or GM is needed currently).
Second, install MacPorts from SVN using these directions taken from macports site
Check out MacPorts source
In Terminal, one line at a time
sudo mkdir -p /opt/mports
sudo cd /opt/mports
sudo svn checkout http://svn.macports.org/repository/macports/trunk
Build and Install MacPorts
MacPorts uses autoconf and makefiles for installation. These commands will build and install MacPorts to /opt/local. I ran all these with the sudo command before them to avoid permissions problems
sudo cd /opt/mports/trunk/base
sudo ./configure --enable-readline
sudo make
sudo make install
sudo make distclean
Open /opt/local/etc/macports/sources.conf in a text editor. The last line which should look like this:
rsync://rsync.macports.org/release/ports/
Change it to point to the working copy you checked out:
file:///opt/mports/trunk/dports
Now MacPorts will look for portfiles in the working copy.
After installing MacPorts, you may need to add it to your PATH, so go ahead and run in terminal:
export PATH=$PATH:/opt/local/bin
and then
sudo port -d sync
This will make sure that it is added to your path, and you shouldn’t have to specify full paths to binaries. The second command tells macports to download the latest versions of the portfiles (instructions for macports on installing a program)
Once everything with macports is finished setting up, open up a terminal window and type
sudo port install samba3
It’ll automatically install samba 3 and all of its dependencies.
Now to edit the configuration! It’s pretty straight forward if you read through the config file located at /opt/local/etc/samba3/smb.conf (it’s callend smb.conf.sample, just remove the .sample from the filename and open with textwrangler).
Your shares should look something like this (you can have as many as you like):
[Downloads]
comment = Downloads
path = /Users/jodsclass/Downloads
available = yes
guest ok = yes
create mask = 644
directory mask = 755
read only = no
[Movies]
comment = Movies
path = /Volumes/MyBook/Movies
available = yes
guest ok = yes
create mask = 644
directory mask = 755
read only = no
[TV]
comment = TV
path = /Volumes/MyBook/TV Shows
available = yes
guest ok = yes
create mask = 644
directory mask = 755
read only = no
Also, remember to change your workgroup name to match the rest of the machines on your network, mine are all on workgroup so mine looks like
# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
workgroup = WORKGROUP
And the name of my mac is imac so my server string is
# server string is the equivalent of the NT Description field
server string = imac
(that way SMB shares can be accessed at smb://imac instead of using IP based). You can leave the rest of the config file commented out.
All that’s left now is to do
sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D
(I’m using full paths so we dont accidentally start up the apple supplied smb server ) and samba will be up and running. The only downside I’ve found is that you do need to remember to start samba every time you reboot (the “sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D” commands).
You can use the following launchagent to start the samba server everytime your machine restarts.
Download mine here and put it in /Library/LaunchAgents, and it should automatically start up samba for you.
Now in XBMC just add your samba shares as follows.
smb://imac (or whatever your machine is called in the server string above)
NOTE: Please remember to turn off SMB sharing in settings>sharing>File Sharing as the built in OSX Lion SMB implementation will clash with the one you installed via Macports
UPDATE – I’ve found a much better fix – Use NFS shares instead- Use NFS shares instead of Samba with XBMC