Want ad-free Spotify without paying for Premium? Here’s a detailed guide to set up spotify-adblock with the Flatpak version of Spotify on Linux. I’ve tested this on Ubuntu (as of March 08, 2025), and it works with a few tweaks. We’ll use a shell alias for easy launching. Let’s go!
Prerequisites
Step 1: Install Rust (for Building spotify-adblock)
spotify-adblock is written in Rust, so you need cargo to build it.
1. Install Rust:
curl --proto '=https' --tlsv1.2 -sSf You do not have permission to view the full content of this post. Log in or register now. | sh
- Press 1 (default install) when prompted.
2. Update PATH:
source ~/.cargo/env
3. Verify:
cargo --version
- Should output something like cargo 1.75.0. If not, troubleshoot Rust install.
Step 2: Clone and Build spotify-adblock
1. Clone the Repo:
cd ~/Documents
git clone You do not have permission to view the full content of this post. Log in or register now.
cd spotify-adblock
2. Build It:
make
- This creates target/release/libspotifyadblock.so.
3. Install It:
sudo make install
- Installs libspotifyadblock.so to /usr/local/lib/ and config.toml to /usr/local/etc/spotify-adblock/.
4. Verify:
ls /usr/local/lib/spotify-adblock.so
ls /usr/local/etc/spotify-adblock/config.toml
- If config.toml is missing (it happened to me), copy it manually:
sudo mkdir -p /usr/local/etc/spotify-adblock
sudo cp ~/Documents/spotify-adblock/config.toml /usr/local/etc/spotify-adblock/
Step 3: Set Up for Flatpak
Flatpak sandboxes apps, so we need to adjust paths and permissions.
1. Copy Library to User Directory:
- /usr/local/lib/ is blocked by Flatpak’s sandbox, so use ~/.spotify-adblock/:
mkdir -p ~/.spotify-adblock
cp /usr/local/lib/spotify-adblock.so ~/.spotify-adblock/
2. Copy Config File:
- Flatpak might not see /usr/local/etc/, so put config.toml with the library:
cp /usr/local/etc/spotify-adblock/config.toml ~/.spotify-adblock/
3. Grant Flatpak Access:
flatpak override --user --filesystem=~/.spotify-adblock com.spotify.Client
Step 4: Test the Setup
1. Run Spotify with Adblock:
flatpak run --command=sh com.spotify.Client -c 'eval "$(sed s#LD_PRELOAD=#LD_PRELOAD=$HOME/.spotify-adblock/spotify-adblock.so:#g /app/bin/spotify)"'
2. Check Behavior:
- Spotify should open. Play music on the free tier.
- No ads or silence where ads would be = success!
- Ads still play? Check troubleshooting below.
Step 5: Create a Shell Alias
Typing that command every time sucks. Let’s make an alias.
1. Edit .bashrc:
nano ~/.bashrc
Add this at the end:
alias spotify='flatpak run --command=sh com.spotify.Client -c "eval \"\$(sed s#LD_PRELOAD=#LD_PRELOAD=\$HOME/.spotify-adblock/spotify-adblock.so:#g /app/bin/spotify)\""'
- Note the extra \ escapes for the alias to work.
2. Apply Changes:
source ~/.bashrc
3. Launch Spotify:
spotify
- Now just type spotify to run it with ad-blocking
Prerequisites
- Linux system (e.g., Ubuntu, Debian-based).
- Flatpak installed: sudo apt install flatpak if you don’t have it.
- Spotify from Flathub: Install with flatpak install flathub com.spotify.Client.
- Terminal access and basic command-line comfort.
Step 1: Install Rust (for Building spotify-adblock)
spotify-adblock is written in Rust, so you need cargo to build it.
1. Install Rust:
curl --proto '=https' --tlsv1.2 -sSf You do not have permission to view the full content of this post. Log in or register now. | sh
- Press 1 (default install) when prompted.
2. Update PATH:
source ~/.cargo/env
3. Verify:
cargo --version
- Should output something like cargo 1.75.0. If not, troubleshoot Rust install.
Step 2: Clone and Build spotify-adblock
1. Clone the Repo:
cd ~/Documents
git clone You do not have permission to view the full content of this post. Log in or register now.
cd spotify-adblock
2. Build It:
make
- This creates target/release/libspotifyadblock.so.
3. Install It:
sudo make install
- Installs libspotifyadblock.so to /usr/local/lib/ and config.toml to /usr/local/etc/spotify-adblock/.
4. Verify:
ls /usr/local/lib/spotify-adblock.so
ls /usr/local/etc/spotify-adblock/config.toml
- If config.toml is missing (it happened to me), copy it manually:
sudo mkdir -p /usr/local/etc/spotify-adblock
sudo cp ~/Documents/spotify-adblock/config.toml /usr/local/etc/spotify-adblock/
Step 3: Set Up for Flatpak
Flatpak sandboxes apps, so we need to adjust paths and permissions.
1. Copy Library to User Directory:
- /usr/local/lib/ is blocked by Flatpak’s sandbox, so use ~/.spotify-adblock/:
mkdir -p ~/.spotify-adblock
cp /usr/local/lib/spotify-adblock.so ~/.spotify-adblock/
2. Copy Config File:
- Flatpak might not see /usr/local/etc/, so put config.toml with the library:
cp /usr/local/etc/spotify-adblock/config.toml ~/.spotify-adblock/
3. Grant Flatpak Access:
flatpak override --user --filesystem=~/.spotify-adblock com.spotify.Client
Step 4: Test the Setup
1. Run Spotify with Adblock:
flatpak run --command=sh com.spotify.Client -c 'eval "$(sed s#LD_PRELOAD=#LD_PRELOAD=$HOME/.spotify-adblock/spotify-adblock.so:#g /app/bin/spotify)"'
2. Check Behavior:
- Spotify should open. Play music on the free tier.
- No ads or silence where ads would be = success!
- Ads still play? Check troubleshooting below.
Step 5: Create a Shell Alias
Typing that command every time sucks. Let’s make an alias.
1. Edit .bashrc:
nano ~/.bashrc
Add this at the end:
alias spotify='flatpak run --command=sh com.spotify.Client -c "eval \"\$(sed s#LD_PRELOAD=#LD_PRELOAD=\$HOME/.spotify-adblock/spotify-adblock.so:#g /app/bin/spotify)\""'
- Note the extra \ escapes for the alias to work.
2. Apply Changes:
source ~/.bashrc
3. Launch Spotify:
spotify
- Now just type spotify to run it with ad-blocking