Stream Videos and Music From Your Mac To Your iPhone or iPad

| MGG Answers

Question:

Jordan writes: How do I stream the movies and music in my iTunes library directly to my iPad or iPhone? I can stream to another Mac using iTunes Sharing, but that doesn’t seem to be accessible from my iPad or iPhone even if I’m on the same WiFi network.

Answer:

This is an interesting one, Jordan, and while it requires a few steps, it is possible, and it is free! In a nutshell, you need to do only two things: enable websharing on your Mac, and then make your iTunes media folder accessible from the web. Once you do that, you can then use Safari on your iPhone or iPad to play or listen to music streamed from your Mac. As an added benefit, because Safari is currently allowed to “multitask” and run in the background on those devices, you can listen to your streamed music while doing other things on the device!

Step 1: Link Your iTunes Folder To Your Web Share

Mac OS X’s Web Sharing enables you (and others, more on that below) to browse the contents of both the /Library/WebServer/Documents/ folder as well as the “Sites” folder in your home directory from the web. Your iTunes media, of course, is stored elsewhere, so the simplest way to resolve that is to put a link to your iTunes folder inside one of the folders that Web Sharing sees. There are other ways, but doing it this way keeps you from having to move your iTunes Library anywhere. For our purposes (and to save from editing Unix configuration files) we’ll put our links in the former (non-User folder) directory.

Normally if you wanted to create a link in Mac OS X, you would use the Finder’s “Make Alias” function. Unfortunately, Web Sharing and Aliases don’t play nice together. Because Mac OS X’s Web Sharing uses the open-source Apache web server, we need to treat it like a Unix program. And Unix programs prefer what’s called “symbolic links” (or “symlinks”) instead of aliases. This involves a quick trip to the terminal, but I promise it won’t be too scary.

Open your Terminal (in Applications->Utilities->Terminal) and type the following command (you can copy and paste from here, if you like):

ln -s ~/Music/iTunes/iTunes\ Media/Music/ /Library/WebServer/Documents/music

As a bonus, if you’d like to have quick and easy access to your movies, as well, type the following:

ln -s ~/Music/iTunes/iTunes\ Media/Movies/ /Library/WebServer/Documents/movies

Note, the above two commands assume you’re using the latest iTunes media folder organization available in iTunes 9. If those commands don’t work, try either of these pairs depending on where and how your iTunes media is set up.

ln -s ~/Music/iTunes/iTunes\ Music/Music/ /Library/WebServer/Documents/music

ln -s ~/Music/iTunes/iTunes\ Music/Movies/ /Library/WebServer/Documents/movies

or

ln -s ~/Music/iTunes/iTunes\ Music/Music/ /Library/WebServer/Documents/music

ln -s ~/Music/iTunes/iTunes\ Music/Music/Movies/ /Library/WebServer/Documents/movies

Step 2: Set The Right Permissions

Your Mac is picky about which files can be accessed by whom. This is a good thing, and it protects your documents and files, assuming you store them where Apple expects. Your Music folder is, by default, only readable by you. For it to be readable by the Web Server (and, by proxy, you or anyone else accessing your Mac via the web interface) we need to loosen up its permissions a bit. To do this, go into the Finder, choose your home folder, highlight the Music folder, and click File->Get Info. You’ll want to change the “everyone” permissions from “No Access” to “Read only”. Once that’s done, close the window.

Step 3: Enable Web Sharing

The final step is to enable Web Sharing on your Mac. To do this, simply launch System Preferences, click on Sharing, and click the checkbox next to “Web Sharing”. You may be asked to enter an Administrator password to do this. We’ve highlighted it in red below.

Step 4: Browse To Your Music Library

While you’re there in the Sharing preference pane, you’ll also see a link labeled “Your computer’s website is available at this address”. We’ve highlighted it in green above. Once Web Sharing is enabled, click on this link and you’ll be brought to your browser of choice (and hopefully you’ll see a very basic website!). Now, the trick is to append either “music” or “movies” to whatever address appears in your title bar.

This should then bring you to a screen where you can navigate your Mac’s music library and, as you drill down, select and play songs. If it works here, it will likely work on your iPhone or iPad with the same address. If it does not, try replacing whatever address it says with your Mac’s IP address (i.e. http://192.168.1.101/music) and see if that works.

Also, if you sync your Safari bookmarks with MobileMe, just add these links to Safari on your Mac and magically they’ll be there for you on your iPhone, iPad, and iPod touch. 

Safety and Security

It’s important to note that you have now shared your music library with anyone who can access your Mac over the Internet. Most of you won’t have to worry, though, since your standard Apple AirPort or 3rd-party (Linksys, Netgear, etc) router will NOT route web requests to your Mac by default. It can be done, of course, but if you’ve done that, you probably know how it all works anyway. 

 

This question was originally answered on MGG 257: Bookmarks, Symlinks, Spotlight Security & Geek Challenges

About MGG Answers:

Each week Dave Hamilton and John F. Braun provide some great troubleshooting advice to listeners of the Mac Geek Gab podcast. Here with MGG Answers we share some of those tips with the rest of the world!

Sign Up for the Newsletter

Join the TMO Express Daily Newsletter to get the latest Mac headlines in your e-mail every weekday.

60 Comments Leave Your Own

DCJ001

Instead of having to synchronize your videos to device you can now watch them over air. Suddenly the capacity of your iPhone/iPod touch is infinite and the nuisance of iTunes is gone.

Air Video Free:

http://itunes.apple.com/app/air-video-free-watch-your/id313056918?mt=8#

johnkell

Another option is the iPad/iPod/iPhone application called AirVideo. Trust me, it is a remarkable application that has changed how I use both my iPad/iPhone in the past two weeks.

jcn_13

Thanks for this tip, works perfectly. As for Air Video, I’ve tried the Air Video Free app and the Mac OS X Web Sharing technique outlined in this article works much better than Air Video when streaming video that is already in an iTunes compatible format. The only real advantage that Air Video has is the ability to convert non-iTunes video on the fly (“live” conversion—for example, converting an MPEG2 or MKV video to something that will stream to the iPad/iPhone). However, if you already have a library of iTunes/iPod/iPhone/iPad compatible video then the Web Sharing works very well (and better than Air Video, IMO).

StreamToMe is another app that does live conversion, and in my hands StreamToMe is actually more stable (i.e. has fewer bugs) than Air Video.

Rudy Fiorillo

It seems like it would be easier if you bought Streamtome (iPad app for .99).  Very simple to use and you can stream video and sound from any folders—it does all the work for you. Inaddition to getting the app for the iPad, you also have to load the app from it’s website on your computer. (free). This allows your computer and iPad to speak to each other. This program is a dream.  R.

Paddy

How do you get it to work if iTunes is located on an external hard-drive?

Dave Hamilton

The big thing that I prefer about doing it this way versus any other is that I can listen to streamed music and podcasts in the background this way. With a 3rd party app, that isn’t (yet) possible (but we know it’s coming).

How do you get it to work if iTunes is located on an external hard-drive?

This gets a little tricky. You need to change the first path in the “ln -s” command to point to your external library. There are so many possible permutations here that it’s impractical to list them all. However, the idea is this:

ln -**PATH TO MUSIC FOLDER HERE** /Library/WebServer/Documents/music 


Now, a more sure-fire way of doing this is to use the Mac’s Finder-to-Terminal drag feature. You can drag a folder to the Terminal and it will auto-populate the command line with the path to that folder. It’s handy, and you’d use it like such:

1) Type (or paste*) ‘ln -s ’ (without the quotes, but with a space at the end)
2) Drag your iTunes Music folder to the terminal. It should autopopulate with something like ‘/Volumes/My External Drive/iTunes Folder/Music’
3) Type (or paste*) ’ /Library/WebServer/Documents/music’ again without the quotes but with a leading space.
4) Press enter and then repeat with your movies folder, changing “music” to “movies” in step 3

*Note: if you’re going to copy/paste, make sure you only copy the text and not the quotes AND not a carriage return. You don’t want the terminal processing these commands before you’re ready.

Paddy

Dave,
Thank you very much for the help, it worked a treat. Looking forward to listing to my music and watching movies on the go.

Eric

This works fine with .mp3 but not .m4a on an iPad.

Dave Hamilton

This works fine with .mp3 but not .m4a on an iPad.

Yes. You’ll find that it works with anything the device can play with the exception of DRM’ed files.

Mattgriff

Hi - I followed the instructions to the letter, but when i tried to access the URL it said:

Forbidden

You don’t have permission to access /music/ on this server.

Any ideas?

jcn_13

Eric said:This works fine with .mp3 but not .m4a on an iPad.
Yes. You?ll find that it works with anything the device can play with the exception of DRM?ed files.

Yes, with audio files it appears that only MP3s work (AIFF and WAV will also play but seem to have issues with buffering). Also, it’s not exactly true that it “works with anything the device can play” since the iPad can play .m4a from within the iPod app.

It’s also been reported that this technique allows you to view PDFs, text files, and pictures.

zanepost

Hi - I followed the instructions to the letter, but when i tried to access the URL it said:

Forbidden

You don?t have permission to access /music/ on this server.

Any ideas?

I have the same problem…

my permissions are everyone can read. am excited to try this

Eric

I was getting that too - copied the path from iTunes preferences, and recreated the symlink and I was good to go.

Note - I did have to delete the old “music” alias to create the new one. And yes I said alias (thats what finder was calling it) the icon is also visually different when it works.

Peter Harrison

I’ve been having the same problem. And the alias wasn’t working. I’ve figured out the correct line to use in Terminal now and also had to delete the faulty alias. So now I have a music and movies alias in the webserver area, created via the Terminal. It has worked, as it now looks like a folder and I can follow the alias via the Finder. Also, I’ve activated Web Sharing and I get the “It Works” page when I visit http://myaddress

But when I visit http://myaddress/movies (or music) I still get the Forbidden access message. I’m sure I’ve done everything right. The folders are read-only for “Everyone” (which was actually my default setting) and the alias has worked. Where am I going wrong?

Eric

Are you sure that you created a “symlink” and not just an “alias”. An alias will work in finder, but not in Apache.

zanepost

Are you sure that you created a ?symlink? and not just an ?alias?. An alias will work in finder, but not in Apache.

i used the terminal command to make it. so i think so.

Peter Harrison

If the information above is all that is required, using Terminal and changing permissions, then I’ve done it right.

Mattgriff

OK - managed to work out how to correct this.
Step 1 - consolidated iTunes library
Step 2 - deleted symlink that I created initially.  I had to delete both music and movies symlink using:
rm /Library/WebServer/Documents/movies
Step 3 recreate symlink by drag and dropping location from finder into terminal, looked like:
ln -s /Users/mattgriff/Music/iTunes/Movies /Library/WebServer/Documents/movies

Retried the link and everything works!

Ericdsa

If the folder in the link is blue - I would say it is correct.

I went back and created the link by the directions posted and the link is not blue, nor does it take me anywhere when clicked directly.

I also tested changing permissions on the Documents folder (in /Library/WebServer) - if the permissions are wrong here, you will get forbidden also.

Peter Harrison

I’ve done the exact same, removed it with Terminal, recreated, still gets the same problem. It is seeing it, because if I try to use a non-existent folder name in the URL then I get a simple failure. But what I’m getting is still a permissions problem. Web sharing is active, permissions for the folders in question are set to read-only for “Everyone”. I’m stumped.

Ericdsa

Mattgriff - You just worked the problem from the other end. Instead of making the link point to your stuff, you moved your stuff to where your link was pointing.

Works just the same.

Peter Harrison

Well, I’ve given up.

Air Video it will be.

Ericdsa

I?ve done the exact same, removed it with Terminal, recreated, still gets the same problem. It is seeing it, because if I try to use a non-existent folder name in the URL then I get a simple failure. But what I?m getting is still a permissions problem. Web sharing is active, permissions for the folders in question are set to read-only for ?Everyone?. I?m stumped.

A link that does not point to the correct spot still exists - not the same as a link that does not exist at all.

Did you click on the created link in the finder and see your stuff? If you did then the link is valid. Then go to the “Documents” folder in the webserver’s directory and make sure its permissions are correct. If they are wrong, you will get the “Forbidden” error. This is not mentioned by the article, it is assumed.

This may not be your problem - but if it is not - I am stumped for now.

piratemc74

Hi - great directions. How do I get it to display the entire directory? It stops after xx entries.

Also, what if the media is stored on an external drive? Itunes knows where it is, but, this method doesn’t see it. Any suggestions?

Ericdsa

piratemc74 - Are you using the default directions? They assume the library to be in the standard spot. You would have to alter the symlink creation instructions to reflect where iTunes is looking for your stuff. Also, I am not sure if a symlink pointing to another symlink would work - if that is how you are pointing to the external drive.

Peter Harrison

Does this make any sense to anyone:

I had to change the Terminal instructions because the movie folder is in a slightly different place. Did it by dragging the folder into the Terminal and it all seems to have worked. In the webserver/documents folder I can see the shortcut to my movies folder and it is blue like a normal folder alias would be. If I double click it, I get taken to the movie files. All good. The original movies folder has “Everyone” permission set to read-only. The webserver/documents folder is also set the same way. Web sharing is enabled. I keep getting a message that /movies is forbidden as I don’t have permission.

I tried putting an actual film in there rather than a shortcut, just to try it that way too. It didn’t work for the films I had downloaded without iTunes or copied from DVD, but I put the iTunes version of Up in there as a full file (copy/paste) and it actually worked. But I really don’t want to copy my films there, I’d like this symlink thing to work. Any more suggestions for my permissions problems. Movies folder is set correctly, webserver folders are set correctly, web sharing settings are enabled. Anything else I can try!?

Ericdsa

Everything sounds correct to me. But, this file that did play, did you try placing it in the symlinked location and try using it there?

Peter Harrison

I’m not sure I follow. When I got a file to play, I actually copied the movie itself (up.m4v) to the webserver/documents folder and visited http://myaddress/up.m4v and it played on my iPhone.

I’m unable to play the original found in the real movies folder that the symlink points to, because I don’t have permission to access that folder.

I go to http://myaddress/movies and I get this:

“Forbidden

You don’t have permission to access /movies/ on this server.”

Incase it’s what you meant, I also tried http://myaddress/movies/up.m4v but I get the same permissions problem.

Ericdsa

Yes - you have shown that the webserver works, and that the file works. So it truly is the symlink that is the problem.

Mattgriff

@Peter Harrison
I had a similar issue on a specific movie folder i had created for iphone movies.
The folder was marked as read only for everyone and i could view the folder fine in Safari.  When I tried to play a movie, it was shown as forbidden.
When I checked the access rights, the movies had “No Access” showing.
The only way I could rectify was to change access on each individual movie..???
Long winded, but it worked!

Peter Harrison

Similar but different. I can’t even get permission to view the folder through Safari, let alone the files in the folder. I don’t have the same problem as you, because all my movies are set to read-only as well for Everyone.

And just so you know in future (on Snow Leopard at least): Go to the folder that contains the movies and check the permissions. Unlock the little padlock if it is locked. Set the permissions the way you want. Then, click the little “cog” button and the first option allows you to set all the files that are in the folder to have the same permissions. This would have saved you setting them all individually.

Still no success over here.

Ericdsa

@PeterHarrison If you go to the webserver/Documents folder and create a folder named “Test”, can you go to the browser and see it?

Peter Harrison

That worked. I can see an empty directory. But I suppose this is the same as finding that the movie file worked too. As long as shortcuts, aliases or symlinks etc aren’t involved, then it works.

Ericdsa

@PeterHarrison.  Yes, that is the same, but I was doubting my understanding of your problem from your previouse response. I really want to believe the symlink is created wrong, but you say clicking on it shows you you stuff. Assuming that is true, then Apache must not be handling symlinks on your Mac correctly.

I guess if you created a symlink to something simpler, and it did the same thing that would be good evidence.

Peter Harrison

I appreciate the help, so thanks. I tried using Terminal the same way to create a symlink to the Up movie file and also to some other folders with no success. Will maybe ask an Apple Genius next time I’m at the store.

Ericdsa

@PeterHarrison.    Sure thing. I guess we showed that it’s an Apache-symlink thing, anyway.

Maybe Dave Or John will have some idea.

Dave Hamilton

@PeterHarrison It’s possible that for whatever reason your Apache install is not supporting SymLinks. It’s important to note that, by default, your ~/Sites folder does NOT support them, but the /Library/WebServer/Documents does, hence the reason I pointed there for this tip, saving us all the step of editing apache configuration files.

If you look in /etc/apache/httpd.conf you should see two things:

DocumentRoot "/Library/WebServer/Documents" 

and

<Directory />
    
Options FollowSymLinks
    AllowOverride None
    Order deny
,allow
    Deny from all
</Directory

The “FollowSymLinks” part of this is the key. If, for whatever reason, that’s not there, then apache won’t follow them and all is lost.

Along these same lines, if you want to put the symlinks in your ~/Sites/ folder instead of the main apache docroot, you first need to edit /etc/apache/users/[username].conf and add “FollowSymLinks” to the “Options Indexes MultiViews” line, then restart web sharing.

Peter Harrison

Spotlight search indicates that there is no file called apache.conf on my computer. It’s Snow Leopard and I never would have deliberately removed any files… Weird. Guess I should do a system restore or at least reinstall OSX if that’s possible.

Dave Hamilton

Spotlight search indicates that there is no file called apache.conf on my computer.

Don’t panic yet. Spotlight will not find that file. By design, spotlight ignores MANY system files, including everything in /etc (and /private, too)

Ericdsa

@PeterHarrison Are you sure your looking for the correct file? Why use spotlight? Just drill down to the directory the file is in.

Peter Harrison

I’ve got no idea where to drill down to. I’m a fairly light user of the Mac, and don’t usually have anything to do with system files. I used Spotlight to search because anything I’d usually search for would be found with Spotlight and I didn’t realise it would skip many system files. Sorry about that. At first I thought “etc” was an ex cetera or something. Where do I find these etc and apache folders?

Ericdsa

@PeterHarrison Cool way to learn. I would use the terminal (terminal.app), go to the root directory (the top level of the drive) and /etc is one of the first level subdirectories.

zanepost

i finally got it to work, my weird problem was i made a symlink to the music folder inside the itunes music folder (/itunes music/music). although the music folder had permissions set for everybody the parent folder of itunes music did not. so i just fixed the permissions of itunes music and actually made that the sym link (that way i can stream my podcasts too)

thanks guys, and thanks for this answers forum. this is great

Peter Harrison

@zanepost: Just tried that as well but no luck for me. Enjoy your streaming! :p

@Ericdsa: I’m away to learn how to use the Terminal so I can give it a go. I should pick it up fairly quick, as I used to be able to use MS DOS years ago. Can’t be too different, can it? Guess I’ll find out. Will report back.

Ericdsa

@PeterHarrison   As always, on the phone or via email - it is very hard to know what I am saying is the same thing you are hearing and vice versa.

Peter Harrison

Quickly learned the basics of navigating using Terminal, found the .conf file. I viewed it, and found both of these:

DocumentRoot “/Library/WebServer/Documents”

and

<Directory >
  Options FollowSymLinks
  AllowOverride None
  Order deny,allow
  Deny from all
</Directory>

Ericdsa

@PeterHarrison Looks correct to me

Joe Bramande

Guys, I am stumped as well, I am new to macs, so require a little more hand holding than normal. Plus to make things more complicated, I have my itunes stored on an external hard drive. I keep getting an error that says You don’t have permission to access /music on this server.
Why hasn’t somebody created an App for this yet. (DRM protected)

Ben Greiner

Instructions for how to do this same thing using Mac OS X server are posted here: http://support.forgetcomputers.com/entries/181294-how-to-stream-video-to-your-ipad-or-iphone

Dankw

The method works perfectly for me ... For MP3s and Handbrake video. But   Not M4A files or AVI movies. Is this a problem with the server configuration on my Mac mini, or an iPad Safari issue? Thanks for the great tips!

Ericdsa
Tez

This looks fantastic, the problem I have is my iTunes library is on my time capsule,how would I get it to work?

zanepost

Tez s

if the drive is mounted, then the sym link will work. it’s just an external drive, whether it’s firewire or ethernet..

toadguy

Hi.

by following the instructions from mattgriff(ie dragging the link to music into terminal I got it to work. The terminal instruction I got was(the MYUSERNAME is obviously going to be different for you)

ln -s /Users/MYUSERNAME/Music/iTunes/iTunes\ Music /Library/WebServer/Documents/music

And in the sharing panel instead using the personal website link I used the computer website link with /music in front of it.

http:/192.168.2.3/music/

Only problem is the not playing aac files(m4a). Mp3s work fine but when importing all my cds over the years I’ve used aac as it’s supposed to be better.

Strangely when I click on one of the m4a safari gives me the option to open them in Goodreader(the pdf reader) which does play the m4a, but only 1 at a time and it doesn’t work in the background.

So it looks like until apple let us share itunes library to ipad I will have to look at airvideo.

pups4peace

This is awesome! I can view my movies just fine. I too get the Fobidden You don’t have access error. Also, I can’t view my TV shows. Can someone show me how to edit the link for that? I tried the obvious but that did not work.

Thanks!!

Ericdsa

The tv shows are a folder in music. /music/TV Shows

I am sure a symlink could be created to point to it directly also.

I hope I understood your question correctly.

Mondozer

I have the same failure under the same circumstances as Peter Harrison. Anyone have more advice?

Nerm

Hi,

Now that Web Sharing has been killed in Mountain Lion is there a work-around to make this work please?

Cheers,

Dave Hamilton

Good news, Nerm!

You can still enable web sharing in Mountain Lion the easy way (with MAMP) or the hard way (with Terminal)

Saquib Usman

Hello all,
For anyone having permissions issues, it might be because you are not functioning under the superuser. use the sudo command before any other command to perform it as a superuser.

sudo ln -s ~/Music/iTunes/iTunes\ Media/Music/ /Library/WebServer/Documents/music

then the terminal will ask for your password, type it in and viola! it should work!

-Saquib

Log-in to comment