Set up

Put shangOS on your TV

Turn on debugging, run one command on your computer, follow the wizard. About five minutes, and you can undo all of it.

Before you start

You need an Android TV or Google TV on Android 12 or newer, a computer on the same Wi-Fi or network cable, and the TV remote. It takes about five minutes. It needs no root and replaces no firmware.

What changes on your TV

One app is installed, and it is set as the home screen. The TV’s own home and setup apps are left switched on (on some Google TVs the TV cannot start without them). If you choose them, three optional permissions are granted (Up Next, Now Playing, recent apps) and the shangOS screen saver is selected. Nothing else is touched. HDMI, Chromecast, picture settings and Bluetooth remotes keep working.

Not for phones and tablets. Not tested on Fire TV.

1. Turn on debugging on the TV

  1. Become a developer

    Find the build entry for your TV in the table below, and press OK on it seven times until a message says You are now a developer.

    Menu names change between firmware versions. If yours differ, search Settings for “Build” and “Developer options”.
    Your deviceTurn on Developer optionsThen open
    Google TV Streamer, Chromecast with Google TV, onn., TCL, Hisense, Sony BRAVIA (Google TV)Settings, System, About, press Android TV OS build 7 timesSettings, System, Developer options
    Sony BRAVIA (older Android TV), Philips, SharpSettings, Device Preferences, About, press Build 7 timesSettings, Device Preferences, Developer options
    Xiaomi Mi Box S, Mi TV Stick, Xiaomi TVSettings, Device Preferences, About, press Build 7 timesSettings, Device Preferences, Developer options
    NVIDIA Shield TVSettings, Device Preferences, About, press Build 7 timesSettings, Device Preferences, Developer options
  2. Switch debugging on

    In Developer options, turn on USB debugging. Some TVs call it Network debugging. On Android 11 and newer you may see Wireless debugging instead; see pairing below.

  3. Allow your computer

    The first time the computer connects, the TV asks Allow USB debugging?. Choose Always allow from this computer and press OK. Look at the TV screen, not the computer.

  4. Find the TV’s address (optional)

    The wizard usually finds the TV by itself. If it cannot, note the IP address under Settings, Network & Internet, then your connection (for example 192.168.1.50).

2. Run the setup wizard

Open a terminal (macOS, Linux) or PowerShell (Windows), and run the line for your computer. No administrator rights are needed.

macOS

Terminal
$ curl -fsSL https://shangos.madusha.dev/setup.sh | bash

Linux

Terminal
$ curl -fsSL https://shangos.madusha.dev/setup.sh | bash

Windows

PowerShell
PS> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex ((New-Object Net.WebClient).DownloadString('https://shangos.madusha.dev/setup.ps1'))

The wizard is five short steps. Move with the arrow keys (or j/k), choose with Enter, switch options with Space, go back with Esc, quit with q.

  1. TV

    Lists TVs adb already knows, TVs announcing Wireless debugging on your network, and addresses you saved. Or type an address, or pair with a code. It checks the TV runs Android 12 or newer.

  2. Build

    Standard, or Offline which has no internet permission at all (no weather, no remote posters).

  3. Options

    Optional permissions, making it the home screen, a faster compile, the screen saver, and ad and tracker blocking (off unless you tick it).

  4. Review

    Shows the exact commands, then asks once.

  5. Install

    Downloads the release from GitHub, checks its SHA-256 against the published SHA256SUMS, installs it, and applies your options. Every command that changes the TV is printed first, on a line starting with +.

Without a menu

For scripts and unattended installs, pass options. --yes (-Yes on Windows) takes every default and asks nothing.

macOS

Terminal
$ curl -fsSL https://shangos.madusha.dev/setup.sh | bash -s -- --tv 192.168.1.50:5555 --variant offline --yes

Linux

Terminal
$ curl -fsSL https://shangos.madusha.dev/setup.sh | bash -s -- --tv 192.168.1.50:5555 --variant offline --yes

Windows

PowerShell
PS> & ([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://shangos.madusha.dev/setup.ps1'))) -Tv 192.168.1.50:5555 -Variant offline -Yes
OptionWindowsWhat it does
--tv ADDRESS-TvThe TV’s address, with or without :5555.
--variant release|offline-VariantStandard (default) or Offline.
--release v0.4.0-ReleaseA specific release instead of the latest.
--apk FILE-ApkInstall an APK you already have.
--no-home, --no-widgets, --no-aot-NoHome, -NoWidgets, -NoAotSkip one step.
--saver-SaverAlso use the shangOS screen saver.
--block-ads-BlockAdsAlso turn on ad and tracker blocking for the whole TV (read the limits).
--dns adguard|HOSTNAME|off-DnsOnly change the TV’s Private DNS; no install.
--status-StatusShow what is installed and what Home opens.
--uninstall-UninstallUndo everything.
--pair HOST:PORT --code 123456-Pair, -CodePair with a TV that shows a code.
--plain, --no-color-Plain, -NoColorNo menus, or no colours.

Read it before you run it

It is a plain text script. The wizard only talks to GitHub (to download the release) and to your TV; the one exception is your own package manager, if you let it install adb.

macOS

Terminal
$ curl -fsSL -o setup.sh https://shangos.madusha.dev/setup.sh
$ less setup.sh
$ bash setup.sh

Linux

Terminal
$ curl -fsSL -o setup.sh https://shangos.madusha.dev/setup.sh
$ less setup.sh
$ bash setup.sh

Windows

PowerShell
PS> (New-Object Net.WebClient).DownloadString('https://shangos.madusha.dev/setup.ps1') | Set-Content setup.ps1
PS> notepad setup.ps1
PS> powershell -ExecutionPolicy Bypass -File .\setup.ps1

No adb on your computer? The wizard offers to install it with your package manager (Homebrew, apt, dnf, pacman, zypper, or on Windows winget, Scoop or Chocolatey) and shows the command first. Or get platform-tools from Google.

Optional: block ads and trackers on the whole TV

shangOS itself shows no ads, but your other apps can. This optional step sets the TV’s Private DNS (an Android setting since Android 9) to a server that refuses known ad and tracker domains. It applies to every app that uses the TV’s normal DNS, and it does not touch shangOS.

macOS

Terminal: turn it on
$ curl -fsSL https://shangos.madusha.dev/setup.sh | bash -s -- --dns adguard
Terminal: turn it off again
$ curl -fsSL https://shangos.madusha.dev/setup.sh | bash -s -- --dns off

Linux

Terminal: turn it on
$ curl -fsSL https://shangos.madusha.dev/setup.sh | bash -s -- --dns adguard
Terminal: turn it off again
$ curl -fsSL https://shangos.madusha.dev/setup.sh | bash -s -- --dns off

Windows

PowerShell: turn it on
PS> & ([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://shangos.madusha.dev/setup.ps1'))) -Dns adguard
PowerShell: turn it off again
PS> & ([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://shangos.madusha.dev/setup.ps1'))) -Dns off

Or tick Block ads and trackers in the wizard’s options, or pass --block-ads (-BlockAds) when installing. Choose Use my own DNS hostname in the wizard’s menu for a NextDNS profile, your own AdGuard Home or a Pi-hole that speaks DNS-over-TLS. The wizard checks that the TV can still look up names afterwards, and puts the old setting back if it cannot.

By hand

Turn it on
$ adb shell settings put global private_dns_specifier dns.adguard-dns.com
$ adb shell settings put global private_dns_mode hostname
Turn it off again (back to the TV's default, called Automatic)
$ adb shell settings put global private_dns_mode opportunistic

What to know first

TopicDetails
Who sees whatThe DNS provider sees the names your TV looks up (for example example.com), though not the pages. Pick one you trust and read its privacy policy. The default here is AdGuard DNS (dns.adguard-dns.com), which blocks ads, trackers and known malicious domains.
It is system-wideFree streaming apps may show fewer ads, load slowly, or refuse to start when their ad servers do not answer. If that happens, turn it off.
Apps can skip itApps that bring their own DNS, or a fixed one, ignore the TV’s setting. Nothing on the TV can stop that without root.
NeedsAndroid 9 or newer. The wizard checks that names still resolve after the change and undoes it if not; if the TV was offline when you set it, it cannot check.
Undo--dns off (-Dns off) puts back whatever the TV had before, or Automatic. Removing shangOS leaves it as it is, and offers to undo it.

For apps that skip the filter (advanced)

The place to catch them is your router, not the TV. Run a filter on your own network (Pi-hole or AdGuard Home), send all DNS requests on port 53 to it, and block outgoing port 853 (DNS-over-TLS) so apps cannot use another server. DNS-over-HTTPS looks like ordinary web traffic, so it can only be stopped with a domain list of known servers. Do one or the other: blocking port 853 also blocks the Private DNS setting above, unless its server is on your own network.

TVs that show a pairing code

Newer Google TV builds can use Wireless debugging, which asks for a one-time pairing first.

  1. Open the pairing box

    Developer options, Wireless debugging, Pair device with pairing code. The TV shows an address with a port, and a six-digit code. Keep that box open.

  2. Pair

    In the wizard choose Pair with a code, or run it yourself:

    macOS

    Terminal
    $ adb pair 192.168.1.50:37123

    Linux

    Terminal
    $ adb pair 192.168.1.50:37123

    Windows

    PowerShell
    PS> adb pair 192.168.1.50:37123

    Type the six-digit code when asked.

  3. Connect

    Close the box. The main Wireless debugging screen shows a different port. Use that one: adb connect 192.168.1.50:41234, or pick the TV in the wizard (it appears under “Found on your network”).

Do it by hand with adb

The wizard runs exactly these. Replace the address and the file name with yours.

adb
# 1. connect, and accept the prompt on the TV
$ adb connect 192.168.1.50:5555
# 2. install the signed release
$ adb install -r shangos-v0.4.0-release.apk
# 3. make it the home screen
$ adb shell cmd package set-home-activity --user 0 dev.madusha.shangos/.MainActivity

Press Home on the remote. If the TV still opens its own launcher, that is normal on some Google TVs. Open shangOS from the app row, or choose “Always” if the TV asks which home to use. Do not switch the TV’s own home or setup app off unless you have read the warning below: on some Google TVs the TV then cannot start.

Optional permissions for Up Next, Now Playing and recent apps:

adb
$ adb shell pm grant dev.madusha.shangos android.permission.READ_TV_LISTINGS
$ adb shell cmd notification allow_listener dev.madusha.shangos/dev.madusha.shangos.MediaListener
$ adb shell appops set dev.madusha.shangos GET_USAGE_STATS allow

Undo everything

Run the wizard and choose Remove shangOS, or pass the uninstall option:

macOS

Terminal
$ curl -fsSL https://shangos.madusha.dev/setup.sh | bash -s -- --uninstall

Linux

Terminal
$ curl -fsSL https://shangos.madusha.dev/setup.sh | bash -s -- --uninstall

Windows

PowerShell
PS> & ([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://shangos.madusha.dev/setup.ps1'))) -Uninstall

By hand, switch your TV’s launcher back on before removing shangOS, so the TV always has a home screen:

adb
$ adb shell pm enable --user 0 com.google.android.tvlauncher
# or com.google.android.apps.tv.launcherx on newer Google TV builds
$ adb uninstall dev.madusha.shangos

Order matters

Removing shangOS while the TV’s own launcher is still switched off can leave the TV with no home screen. If that happens, run adb shell pm enable --user 0 com.google.android.tvlauncher from your computer.

If your TV loops after a restart

Some Google TVs cannot start without their own home or setup app

Older versions of this wizard switched those off to make shangOS the home screen. On some Google TVs (a Sony Bravia, for one) that leaves the TV unable to start: a blank screen, a restart, and round again. Since 0.6 the wizard never switches the setup app off, leaves the TV’s own home on unless you pass --disable-stock, and switches anything an older version turned off back on.

If your TV is looping now:

  1. Switch the TV off at the wall

    Leave it off for 10 to 15 minutes, then switch it on again. Have your computer ready.

  2. Switch them back on as soon as the TV answers

    Each loop gives a short window. Keep trying until the commands go through:

    adb
    $ adb connect 192.168.1.50:5555
    $ adb shell pm enable com.google.android.apps.tv.launcherx
    $ adb shell pm enable com.google.android.tungsten.setupwraith
    $ adb shell pm enable com.google.android.tvlauncher

    Some of these are not on your TV; the error for those is harmless.

  3. Then run the wizard again

    The current version leaves them on. If you set shangOS up with an older version and the TV is not looping, run the wizard once before the next restart: it switches them back on by itself.

If shangOS itself crashes twice within five minutes, it stands aside and lets the TV’s own home open, and tries again a few minutes later, so a broken build cannot hold the TV in a loop either.

Verify a download

If you download the APK yourself, check it before installing. Put the APK and SHA256SUMS from the same release in one folder.

macOS

Terminal
$ shasum -a 256 -c SHA256SUMS --ignore-missing
$ apksigner verify --print-certs shangos-v0.4.0-release.apk

Linux

Terminal
$ sha256sum -c SHA256SUMS --ignore-missing
$ apksigner verify --print-certs shangos-v0.4.0-release.apk

Windows

PowerShell
PS> (Get-FileHash .\shangos-v0.4.0-release.apk -Algorithm SHA256).Hash
# compare with the line in SHA256SUMS
PS> apksigner verify --print-certs shangos-v0.4.0-release.apk

apksigner is part of Android’s build-tools. The certificate SHA-256 it prints must match the release notes on GitHub, and the one shown on the TV under Settings, Privacy, This build.

If something goes wrong

What you seeWhat to do
failed to connect, or the TV is not listedThe TV and computer must be on the same network, and debugging must be on. Wake the TV first. Try the address with :5555. On newer builds use Wireless debugging and pair.
unauthorizedLook at the TV. An Allow USB debugging? box is waiting: choose Always allow from this computer, then OK.
Home still opens the old launcherSome TVs insist on their own. shangOS leaves it on, because on some Google TVs the TV cannot start without it. Open shangOS from the app row. At your own risk, --disable-stock (-DisableStock on Windows) switches the launcher off after asking; read the warning first.
INSTALL_FAILED_UPDATE_INCOMPATIBLEThe TV has shangOS signed with another key, for example a build you made yourself. Android will not update it in place. The wizard offers to remove the old one first; that clears shangOS’s own settings only.
INSTALL_FAILED_VERSION_DOWNGRADEThe TV has a newer version than the one you are installing. The wizard offers to downgrade.
No TV found by the wizardSome routers block the announcements that discovery uses. Give the address yourself: --tv 192.168.1.50:5555.
GitHub is rate-limitingWait a few minutes, or download the APK from the release page and pass it with --apk.
Windows: “running scripts is disabled”That applies to saved files only. The one-line command is not affected. For a saved copy, use powershell -ExecutionPolicy Bypass -File .\setup.ps1.
Apps stopped loading after I turned on ad blockingTurn it off with --dns off (-Dns off). Some apps depend on the ad servers answering.
Colours or boxes look brokenUse a modern terminal (Terminal, iTerm2, GNOME Terminal, Windows Terminal), or add --plain (-Plain) for plain text.
On this page