Apple TV: installing your own apps from an iMac via Terminal
How to build your own tvOS app and install it on an Apple TV from an iMac on the same local network, without a cable. Xcode is needed once to sign in to your Apple ID and pair the device; everything else is done with Terminal commands.
1. What you need
- An iMac (or another Mac) with the latest Xcode from the App Store. The tvOS version on the box must not be newer than the one Xcode supports.
- Apple TV HD or Apple TV 4K (older 2nd/3rd generation models don't support third-party apps).
- Apple ID. A free one works, but the installed app then runs for 7 days. With a paid Apple Developer Program membership the signature is valid for a year.
- Mac and Apple TV on the same local network (same subnet, no guest Wi-Fi, no VPN). The router must allow Bonjour/mDNS.
- Your app project with a tvOS target. In the examples below the project is called
MyTVAppand the Apple TV is calledLiving Room.
2. Preparing Xcode
Select the full Xcode for the command line, accept the license and download the tvOS platform (if it wasn't installed with Xcode):
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
xcodebuild -downloadPlatform tvOS
Sign in with your Apple ID: Xcode → Settings → Accounts → “+” → Apple ID. This is needed only once: xcodebuild uses this account for signing.
Open the project in Xcode, select the app target → Signing & Capabilities tab → turn on “Automatically manage signing” and choose your Team. If needed, set a unique Bundle Identifier, e.g. ru.artvolume.MyTVApp. Check that the settings were saved:
xcodebuild -showBuildSettings -scheme MyTVApp | grep -E "DEVELOPMENT_TEAM|PRODUCT_BUNDLE_IDENTIFIER"
3. Pairing Apple TV with the Mac
- On Apple TV open Settings → Remotes and Devices → Remote App and Devices and stay on that screen.
- On the Mac, in Xcode open Window → Devices and Simulators (called Devices in newer Xcode versions). The Apple TV appears among discovered devices.
- Click Pair and enter the code shown on the TV screen.
- Wait while Xcode prepares the device for development (Preparing device). The first time this can take a few minutes.
You can now quit Xcode. Check from Terminal that the Mac sees the Apple TV:
xcrun devicectl list devices
The Apple TV should be listed with the state available (paired). The name from the Name column is used in the next commands.
4. Building the app from Terminal
Go to the project folder and list the available schemes and destinations:
cd ~/Projects/MyTVApp
xcodebuild -list
xcodebuild -showdestinations -scheme MyTVApp
Build the app for your Apple TV. -allowProvisioningUpdates lets Xcode create the certificate and profile and register the device itself. If the project has an .xcworkspace (CocoaPods), replace -project MyTVApp.xcodeproj with -workspace MyTVApp.xcworkspace.
xcodebuild \
-project MyTVApp.xcodeproj \
-scheme MyTVApp \
-configuration Debug \
-destination "platform=tvOS,name=Living Room" \
-derivedDataPath build \
-allowProvisioningUpdates \
build
The built app ends up in build/Build/Products/Debug-appletvos/MyTVApp.app.
5. Installing and launching on Apple TV
Wake the Apple TV with the remote and install the app:
xcrun devicectl device install app \
--device "Living Room" \
build/Build/Products/Debug-appletvos/MyTVApp.app
Launch it by its Bundle Identifier:
xcrun devicectl device process launch --device "Living Room" com.example.MyTVApp
The app appears on the Apple TV home screen alongside the others.
6. A script to redeploy with one command
Save the script as deploy-tv.sh in the project folder and change the variables at the top to match your project:
#!/bin/zsh
set -e
PROJECT="MyTVApp.xcodeproj"
SCHEME="MyTVApp"
DEVICE="Living Room"
APP="build/Build/Products/Debug-appletvos/${SCHEME}.app"
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -configuration Debug \
-destination "platform=tvOS,name=$DEVICE" \
-derivedDataPath build -allowProvisioningUpdates -quiet build
BUNDLE_ID=$(/usr/libexec/PlistBuddy -c "Print CFBundleIdentifier" "$APP/Info.plist")
xcrun devicectl device install app --device "$DEVICE" "$APP"
xcrun devicectl device process launch --device "$DEVICE" "$BUNDLE_ID"
echo "Done: $BUNDLE_ID -> $DEVICE"
chmod +x deploy-tv.sh
./deploy-tv.sh
List installed apps and remove yours:
xcrun devicectl device info apps --device "Living Room"
xcrun devicectl device uninstall app --device "Living Room" com.example.MyTVApp
7. Troubleshooting
| Problem | Solution |
|---|---|
Apple TV doesn't show up in Xcode or in devicectl list devices | Make sure both devices are on the same subnet, turn off VPN and client isolation on the router. Reopen the “Remote App and Devices” screen on Apple TV |
| No profiles for … were found | Add -allowProvisioningUpdates, check that you are signed in to your Apple ID in Xcode and that a Team is selected in Signing & Capabilities |
| Unable to find a destination matching … | The device name must exactly match the output of xcodebuild -showdestinations. Check that the tvOS platform is downloaded |
| tvOS version not supported | Update Xcode to the latest version |
| Pairing lost after a tvOS or Xcode update | Repeat step 3 |
| The app stopped launching after a week | The free signature expired: run deploy-tv.sh again |