scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

OK, I gave up on scrcpy. Not computer illiterate but was expected easier install on Mac.

Open itoldusoandso opened this issue 3 years ago • 90 comments

MacOS 10.13 Have done as instructed.. CLT, Homebrew and scrcpy. The install process was sluggish, took 16 hours and decided to post on XDA to check sanity of what I am doing.

Sorry guys, this just didn't work out for me. Total fail ;(

Now two more hours later, the install process stayed hanging and still showing "make"... So now after 18 hours I am pulling the plug want to quit. I want to delete scrcpy and put my machine back where it was before start. However, it gives me error when I type in the command:

bash-3.2$ brew uninstall scrcpy Error: No available formula or cask with the name "scrcpy". bash-3.2$

So what do I do now.

See link to XDA post with picture. I don't see how to attach picture here.

https://forum.xda-developers.com/t/installing-scrcpy-now-already-more-than-16-hours-comman-line-tools-homebrew-is-this-normal.4262295/

itoldusoandso avatar Apr 15 '21 07:04 itoldusoandso

were you able to fix it ?

PembaTamang avatar Apr 20 '21 04:04 PembaTamang

Unfortunately not and I am still waiting on instructions on how to get rid of the software. I don't know what to do at this point.

itoldusoandso avatar Apr 20 '21 19:04 itoldusoandso

MacOS 10.13

Probably related: #2059

In particular: https://github.com/Genymobile/scrcpy/issues/2059#issuecomment-767032047

macs that can't update their OS beyond 10.13 need to be warned that homebrew doesn't know or care if they try to update scrcpy it will install incompatible ffmpeg dependencies.

rom1v avatar Apr 20 '21 19:04 rom1v

As an alternative to Homebrew, you could try MacPorts on macOS (I don't know, I have no macOS).

rom1v avatar Apr 20 '21 19:04 rom1v

Well, I looked at MacPorts but it seems to me it's the page doesn't seem to be safe for toddlers. I need the instructions to be for a 5-years old. It's Babylon language for me as far as this is concerned.

People mention the issue starting after 1.6_2? What are your thoughts if I try same steps but I try install 1.6_2 version. Can I do that somehow?

But first I guess I need to clean the mess on my machine. I have CLT, Homebrew and scrcpy installed. So I guess I need to start removing scrcpy but I don't know how, what and where. I don't want to start deleting the stuff in home directory as I said I it's not like regular apps so stuff seems to be spread around like birds feed.

itoldusoandso avatar Apr 20 '21 20:04 itoldusoandso

Hi there 👋, I'm a project member over at MacPorts. We have a port for scrcpy maintained by @MarcelBochtler that sorts out the adb tools for you.

sudo port install scrcpy

Well, I looked at MacPorts but it seems to me it's the page doesn't seem to be safe for toddlers. I need the instructions to be for a 5-years old. It's Babylon language for me as far as this is concerned.

The views expressed here are solely my own. I agree that things can certainly be improved, and we've been doing a lot of work recently to do so (see. the desolate condition thread on our mailing lists). Any suggestions you might have are warmly welcomed.

Just to help you get started, you can download MacPorts from here. Restart the terminal and then run the command I mentioned above to install scrcpy.

macs that can't update their OS beyond 10.13 need to be warned that homebrew doesn't know or care if they try to update scrcpy it will install incompatible ffmpeg dependencies.

We provide ffmpeg binaries all the way from 11 arm 64 to 10.5 ppc, and we take support of older hardware very seriously. We've had some issues building scrcpy pre-10.11 which we'll need to deal with, but we currrently provide pre-built binaries that work out the box for 10.12 upwards which should be fine for you @itoldusoandso.

If you have any questions, feel free to ask. Thanks @rom1v for maintaining this amazing project.

harens avatar May 06 '21 11:05 harens

If you have any questions, feel free to ask. Thanks @rom1v for maintaining this amazing project.

harens, thank you. OK I get it so toddler needs to learn to walk by trying to walk.

So I found here is info on uninstall brew and scrcpy package.

https://github.com/homebrew/install#uninstall-homebrew

https://osxdaily.com/2018/07/29/uninstall-packages-homebrew-mac/

Just staying in the crib and crying will not get me anywhere. I decided to mess with this stuff on my machine so I got to go with it.

Once thats done I'll follow the MacPorts instructions.

itoldusoandso avatar May 06 '21 17:05 itoldusoandso

Okay back here after a while. Uninstalled and cleaned Brew directories. Installed MacPorts. Do not know why I haven't tried it first it seems to me childsplay compared to installing Brew. Instsalled MacPorts and t's a quite small package compared to Brew downloaded 2 GB of stuff. Am I missing something. Anyhow, I am installing scrcpy but it doesn't work. I am getting message: "Port scrcpy not found"

So off to their forum to find out what is the matter. Followed exactly what it says here:

https://ports.macports.org/port/scrcpy/

bash-3.2$ sudo port install scrcpy Error: Port scrcpy not found

Should I ask there or is it question for scrcpy? Not sure what to think of it.

itoldusoandso avatar Feb 03 '22 22:02 itoldusoandso

@itoldusoandso Usually, right after running the MacPorts installer, it downloads a copy of the Portfiles that are required so that sudo port install scrcpy works. It seems that didn't work in your case, possibly because you're on a network where rsync does not work.

Try running sudo port -v selfupdate - if that fails, that's probably the reason why sudo port install scrcpy does not work. In that case, I'd advise you to follow https://trac.macports.org/wiki/howto/SyncingWithGit; that should work on networks where rsync does not.

After that, sudo port install scrcpy should work.

neverpanic avatar Feb 03 '22 22:02 neverpanic

Thank you. I've done the self update and it went on installing the ports.

I noticed following messages in the results:

Total number of ports parsed: 30067 Ports successfully parsed: 30067 Ports failed: 0 Up-to-date ports skipped: 0 ---> MacPorts base is already the latest version. The ports tree has been updated. To upgrade your installed ports, you should run port upgrade outdated

When it was downloading the packages, there were a couple of lines with a message... ---> "Computing dependencies for scrcpy Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option"

Error: No Xcode installation was found. Error: Please install Xcode and/or run xcode-select to specify its location.

Error: Port gd2 requires a full Xcode installation, which was not found on your system. Error: You can install Xcode from the Mac App Store or https://developer.apple.com/xcode/ Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_gd2/gd2/main.log for details.

Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug. Error: Processing of port scrcpy failed

---> Some of the ports you installed have notes: libomp has the following notes: To use this OpenMP library: * For clang-3.8+, or clang-3.7 with +openmp variant: add "-fopenmp" during compilation / linking. * For clang-3.7 without +openmp variant, use: "-I/opt/local/include/libomp -L/opt/local/lib/libomp -fopenmp" python39 has the following notes: To make this the default Python or Python 3 (i.e., the version run by the 'python' or 'python3' commands), run one or both of:

    sudo port select --set python python39
    sudo port select --set python3 python39

=======

When I try to run scrcpy I get following:

scrcpy: command not found

=========================

From what I see is it tells me I need to install full Xcode? Not enough to install Command Line Tools?
I never use Xcode nor command line tools. I had it once and deleted the folder Command line tools to save 1gb space.

Is Xcode still required after Scrcpy is installed?

itoldusoandso avatar Feb 04 '22 04:02 itoldusoandso

Xcode will not be required after scrcpy is installed. I am, however, a bit confused by the message you're getting, since gd2 (the port that failed to build) definitely builds without Xcode and only needs the Command Line Tools.

Make sure xcode-select -print-path prints /Library/Developer/CommandLineTools. If it doesn't, try sudo xcode-select -s /Library/Developer/CommandLineTools.

neverpanic avatar Feb 04 '22 14:02 neverpanic

Isn't there a version of homebrew/macports/other package manager on MacOS which distributes binary packages, so that users don't have to build on install?

rom1v avatar Feb 04 '22 14:02 rom1v

There is, and MacPorts has precompiled binaries for scrcpy: https://packages.macports.org/scrcpy/

Those may or may not be used depending on the user's setup, e.g., installations in locations other than /opt/local will not use binaries, or systems older than macOS 10.12 (where scrcpy doesn't build according to https://ports.macports.org/port/scrcpy/details/ because it doesn't have clock_gettime).

neverpanic avatar Feb 04 '22 15:02 neverpanic

The MacPorts precompiled scrcpy binaries are pretty much useless for the average user because they do require all the dependencies, too!!

scrcpy simply does require tons of dependencies to run in macOS at this point. scrcpy via MacPorts via (in the Terminal app) sudo port install scrcpy installs the exact same ones as brew!

I can share a comparison tomorrow.

LeeBinder avatar May 10 '22 22:05 LeeBinder

I can't report anything new here, so just for the records:

macOS Catalina with Xcode Command Line Tools (2,53 GB), homebrew as non-shallow clone (1.45 GB), adb Platform Tools (33 MB) + a few dependencies scrcpy also uses already pre-installed, because for me these are standard/ default tools I use all the time, already pre-scrcpy.

Right after running brew install scrcpy, the size of the /usr/local/ folder grew by 724 MB, almost all in /usr/local/Cellar = dependencies (98):

click to expand
$ brew deps scrcpy
aom
bdw-gc
brotli
ca-certificates
cairo
cjson
cmocka
dav1d
ffmpeg
flac
fontconfig
freetype
frei0r
fribidi
gdbm
gettext
giflib
glib
gmp
gnutls
gobject-introspection
graphite2
guile
harfbuzz
icu4c
imath
jpeg
jpeg-xl
lame
leptonica
libarchive
libass
libb2
libbluray
libevent
libffi
libidn2
libnghttp2
libogg
libpng
libpthread-stubs
librist
libsamplerate
libsndfile
libsodium
libsoxr
libtasn1
libtiff
libtool
libunistring
libusb
libvidstab
libvmaf
libvorbis
libvpx
libx11
libxau
libxcb
libxdmcp
libxext
libxrender
little-cms2
lz4
lzo
m4
mbedtls
mpdecimal
nettle
opencore-amr
openexr
openjpeg
[email protected]
opus
p11-kit
pcre
pixman
pkg-config
[email protected]
rav1e
readline
rubberband
sdl2
snappy
speex
sqlite
srt
tesseract
theora
unbound
webp
x264
x265
xorgproto
xvid
xz
zeromq
zimg
zstd
$ brew deps scrcpy | wc -l
    98

sudo port install scrcpy: "The following dependencies will be installed (105)":

click to expand
android-platform-tools
aom
autoconf
autoconf-archive
automake
brotli
cairo
curl-ca-bundle
dav1d
db48
ffmpeg
fontconfig
freetype
fribidi
gd2
gdbm
gdk-pixbuf2
gettext
gettext-tools-libs
giflib
glib2
gmp
gnutls
gobject-introspection
graphite2
graphviz
gts
harfbuzz
icu
jbigkit
lame
lcms2
lerc
libLASi
libass
libbluray
libde265
libheif
libidn2
libjpeg-turbo
libmodplug
libnetpbm
libogg
libopus
libpixman
libpng
librsvg
libsdl2
libtasn1
libtextstyle
libtheora
libtool
libunistring
libvorbis
libvpx
libxml2
libxslt
lz4
m4
nettle
openjpeg
ossp-uuid
p11-kit
pango
pcre
perl5.28
pkgconfig
py310-mako
py310-markdown
py310-markupsafe
py310-setuptools
python310
python3_select
rav1e
readline
shared-mime-info
soxr
speex
tiff
urw-fonts
vala
webp
x264
x265
xorg-libX11
xorg-libXau
xorg-libXaw
xorg-libXdmcp
xorg-libXext
xorg-libXmu
xorg-libXt
xorg-libice
xorg-libpthread-stubs
xorg-libsm
xorg-libxcb
xorg-xcb-proto
xorg-xcb-util
xorg-xorgproto
xpm
xrender
zimg
zstd
zvbi
Xft2
XviD

so I didn't even bother (MacPorts also lists the modules which I have already installed in brew which it doesn't see, therefore the diff in # of dependencies).

Sizes and numbers for 11.x Big Sur and 12.x Monterey will differ somewhat.

Again, this is not Romain's @rom1v fault because he currently doesn't have macOS at his fingertips, like he stated before. Therefore any package manager will simply follow its guidelines for installing.

No matter what, it's only a question of time that a nicely small stand-alone package for macOS can be created, one way or the other 👍 💯 Because looking at the Windows version, it's only a tiny number of required runtime libraries:

Bildschirmfoto 2022-05-12 um 22 26 08

LeeBinder avatar May 12 '22 20:05 LeeBinder

port rdeps --index scrcpy will give you an idea where all those dependencies are coming from.

You'll see that a lot of them are required by librsvg, which is a dependency of ffmpeg. Assuming scrcpy does not need SVG support in ffmpeg, one could build a copy of ffmpeg that does not use librsvg using the --disable-librsvg configure flag.

However, it isn't MacPorts (or Homebrew's) goal to provide a specific version of ffmpeg that works for scrcpy – both are general purpose package managers that will provide a reasonable configuration of ffmpeg when its installation is requested, and that includes librsvg and its dependencies.

The MacPorts precompiled scrcpy binaries are pretty much useless for the average user because they do require all the dependencies, too!!

Yes. These precompiled binaries are not meant to be used outside of MacPorts, which will ensure that the required dependencies are also available. They simply save compilation time. I'm not intimately familiar with Homebrew's "bottles" concept, but I think they have the same approach.

What those binaries give you is avoiding local compilation, though. For example, there's no need to install & compile rust, because MacPorts has a precompiled copy of librsvg available: https://ports.macports.org/port/librsvg/details/.

No matter what, it's only a question of time that a nicely small stand-alone package for macOS can be created, one way or the other

You can do this using dylibbundler from the MacPorts scrcpy package:

$> mkdir /tmp/scrcpy
$> cp /opt/local/bin/scrcpy /tmp/scrcpy
$> cd /tmp/scrcpy
$> dylibbundler -b --create-dir --dest-dir libs --install-path '@executable_path/libs' -x scrcpy
$> cp /opt/local/bin/adb .
$> cp /opt/local/share/scrcpy/scrcpy-server .
$> ADB=/tmp/scrcpy/adb SCRCPY_SERVER_PATH=/tmp/scrcpy/scrcpy-server ./scrcpy

You'd probably also have to ship a copy of adb, processed using the same method (although it seems that adb does not actually link against any external libraries that aren't usually present on macOS).

Such a package will also be quite large, though:

$> du -sh /tmp/scrcpy
103M	/tmp/scrcpy/

Additionally, you'd have to comply with the licenses of all bundled binaries when re-distributing, which is also why I will not provide the one I just built anywhere.

neverpanic avatar May 13 '22 13:05 neverpanic

very nice, great info - thanks for sharing it all.

So your self-compiled 103 MB package of scrcpy contains all required dependencies and is working fine for you even after removing scrcpy with all its dependencies via both, MacPorts and homebrew = is true stand-alone?

LeeBinder avatar May 13 '22 13:05 LeeBinder

So your self-compiled 103 MB package of scrcpy contains all required dependencies and is working fine for you even after removing scrcpy with all its dependencies via both, MacPorts and homebrew = is true stand-alone?

I don't have a phone available at the machine I'm currently at, so I didn't actually test the functionality. It does start successfully (and then fails to find a phone), though. I had the MacPorts scrcpy port deactivated when I tested this, but all other dependencies still installed. I did check the scrcpy binary with otool -L and it used the copy of the dependencies from the libs/ directory, not the MacPorts-installed ones. That should make it stand-alone.

neverpanic avatar May 13 '22 14:05 neverpanic

great, thank you, neverpanic! Installing scrcpy via MacPorts right now, then will execute your script. Will leave the house now so it'll be a while before I report back if all went well.

LeeBinder avatar May 13 '22 14:05 LeeBinder

one more install command was necessary here for me so dylibbundler -b ... would run:

sudo port install libusb

full report follows later

LeeBinder avatar May 13 '22 14:05 LeeBinder

It's running 100% fine form what I can tell so far 👍 🥇

Now we can clean-up:

sudo port uninstall --follow-dependencies scrcpy
sudo port uninstall inactive

.. and here's the icon for the app (3kb 8-bit PNG 256x256) :): Icon

LeeBinder avatar May 13 '22 16:05 LeeBinder

scrcpy v1.24 (Catalina).dmg w/o adb compressed with max. compression only weighs 39,1 MB (44,2 MB with adb), so we're pretty much on-par with the 64bit Windows archive now 👍

Additionally, you'd have to comply with the licenses of all bundled binaries when re-distributing, which is also why I will not provide the one I just built anywhere.

@neverpanic @rom1v same would apply to the Windows package which is being supplied here. So basically all that's left for official stand-alone releases for macOS Catalina, Big Sur and Monterey is to add the complying license(s) agreement(s)? (haven't checked the Windows zip how you devs have handled it there)

LeeBinder avatar May 13 '22 17:05 LeeBinder

The launcher script to be placed on the same level as scrcpy, scrcpy-server and adb:

#!/bin/bash
clear
cd "$(dirname "$0")"
ADB=./adb SCRCPY_SERVER_PATH=./scrcpy-server SCRCPY_ICON_PATH=./scrcpy.png ./scrcpy
echo

attached already executable and with icon: run scrcpy.zip

Needless to say one can opt to use pre-installed system-wide adb.

LeeBinder avatar May 13 '22 17:05 LeeBinder

One tiny cosmetic error:

2022-05-13 19:50:33.762 scrcpy[68514:288281] ERROR: Could not open image codec: /opt/local/share/icons/hicolor/256x256/apps/scrcpy.png
2022-05-13 19:50:33.762 scrcpy[68514:288281] WARN: Could not load icon

Could that path also be set in the launcher script? I copied scrcpy.png on the same level as scrcpy, but neither ICON=./scrcpy.png nor IMAGE_CODEC=./scrcpy.png worked - the path error remains the same and scrcpy launches w/o an icon. Final touch-ups :)

[EDIT]: figured it out: SCRCPY_ICON_PATH=./scrcpy.png .. ;)

LeeBinder avatar May 13 '22 17:05 LeeBinder

scrcpy runs fine via the launcher script even from within the mounted .dmg - very cool!

So from my side I'm done, and happy 💯

LeeBinder avatar May 13 '22 18:05 LeeBinder

@LeeBinder I think @rom1v can still provide better result compiling scrcpy against static avcodec avutil sdl et al. similar to windows than bundling full fat ffmpeg I guess , it's been doing here which pulls tons of dependencies. He might have not testing machine or interest in this platform 😔

Genxster1998 avatar May 13 '22 18:05 Genxster1998

I don't see a "full fat ffmpeg" in there:

screenshot

Current ffmpeg binary for mac weighs 77,9 MB.

LeeBinder avatar May 13 '22 18:05 LeeBinder

@LeeBinder :+1:

Thanks for detailed dependencies list most of them are indeed not related but not heavy . This is feasible indeed a lot. I think python pip package manager can be other way .

Genxster1998 avatar May 14 '22 06:05 Genxster1998

@Genxster1998 You're welcome. You're apparently very knowledgeable. Scrcpy's source code is open. When you download and compile it against static avcodec avutil sdl et al., how large is the resulting folder of/with the stand-alone package?

LeeBinder avatar May 14 '22 06:05 LeeBinder

Additionally, you'd have to comply with the licenses of all bundled binaries when re-distributing, which is also why I will not provide the one I just built anywhere.

@neverpanic I just peeked inside the Windows package - no license agreement(s) in there (screenshot):

Bildschirmfoto 2022-05-15 um 22 40 26

I doubt that what would be a requirement for the Mac package is none for the Windows one. In other words, the license compliance has been missing from the Windows package. It would be the same for Mac and Windows, wouldn't it. So once you have compiled that file, it can be added to both packages, making them legal to distribute.

@rom1v if it's of negligible significance to you, the Mac versions could be published.

LeeBinder avatar May 15 '22 20:05 LeeBinder