DEV Community

Cover image for Block ads on Spotify App
Ashwin K Shenoy
Ashwin K Shenoy

Posted on

Block ads on Spotify App

Everyone loves Spotify and sometimes during development, but are tired of its ads that keep coming between songs. Here is a way to block ads through your host file be it Windows or Mac.

Host Content:

# — Spotify Ad Block
# — Spotify Ads Block End

Add the above contents in your host file.

In Windows

Go to C:\Windows\System32\drivers\etc . Open the hosts' file as administrator and add the above contents to it. (You could open notepad/Sublime/Atom as administrator and browse to open the hosts' file.)

Note: Incase the newly added mappings are not working try restarting Windows to take effect

In Mac

To find the hosts file, open Finder and, in Finder's menu bar, select Go > Go to Folder. In the box, type the following location and press Return.

To open it, simply double-click and it will display the file's contents in TextEdit (or the text editor of your choice). Add the host content in it and save.

In most cases, the new mapping should work immediately, but if you're not seeing the correct behavior, you may need to flush your DNS cache. For OS X Lion and OS X Mountain Lion, open Terminal and use the following command. Note that you’ll need to enter your admin password to execute it:

sudo killall -HUP mDNSResponder

For OS X Mavericks +, use this command instead:

dscacheutil -flushcache; sudo killall -HUP mDNSResponder

You could also launch Terminal, type the following command, and press Return. As with all sudo commands, you'll need to also enter your admin password to execute it:

sudo nano /private/etc/hosts

When you're done making changes, press Control-X to exit the editor, Y to save, and Return to overwrite the existing hosts' file. As mentioned earlier, make sure to flush your DNS cache if you notice that your new mappings aren’t working properly.

Do let me know if it works or needs any change in the host file contents in the comment section below.

Write. Share what you know/ how to fix/break/fix things :)

I love the Web. ❤️❤️❤️

Top comments (2)

s0bacc profile image

Thank you for this instruction. However, I don't use Spotify for listening to music because now I have little time for it but music still lives in my heart. That's why I upload my own music on Spotify and click for more here. It gives me a chance to buy Spotify plays and Spotify followers. You should have a look!

davidhomer profile image
Jason David

Looking to boost your tracks? Explore the option to buy Spotify streams and give your music the visibility it deserves, reaching new ears and amplifying your online presence.