Skip to content

Instantly share code, notes, and snippets.

@framinosona
Last active May 31, 2024 17:20
Show Gist options
  • Save framinosona/c4cde8ca26cf22196d6beed67555498c to your computer and use it in GitHub Desktop.
Save framinosona/c4cde8ca26cf22196d6beed67555498c to your computer and use it in GitHub Desktop.
Bash script that installs scrcpy for you if needed and starts it
#!/usr/bin/env bash
#
# Script to start Scrcpy
if test ! $(which scrcpy); then
echo "Starting installation"
# Check for Homebrew, install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Update homebrew recipes
brew update
echo "Installing scrcpy..."
brew install scrcpy
if test ! $(which adb); then
echo "Installing android-platform-tools..."
brew cask install android-platform-tools
fi
echo "Scrcpy is installed, you may need to restart your terminal"
echo "Your Homebrew might be messy now, to cleanup run :"
echo " brew cleanup"
echo ""
#reloading terminal
source ~/.bash_profile
fi
scrcpy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment