-
Notifications
You must be signed in to change notification settings - Fork 28.4k
Reading iOS logs requires sudo access: "log: Must be admin to run 'stream' command" #18409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@devoncarew commented on Jun 12, 2018, 12:34 AM UTC:
Do you have a sense for where this is coming from? |
@xster commented on Jun 12, 2018, 12:38 AM UTC: More interesting was for me: |
@csterritt commented on Jun 12, 2018, 1:05 AM UTC: @xster Not sure if this is useful to your question, but I just downloaded the Mac installer from flutter.io, I didn't build from github or anything like that. Thanks for the quick responses! |
@devoncarew commented on Jun 12, 2018, 5:57 PM UTC: I suspect this is coming from a native tool that we're invoking? In anticipation of that, I'm going to route this to the flutter/flutter repo as a flutter_tools issue. |
I encounter this same message when running on a friend's Mac where the machine user account I signed in has no admin access. On terminal |
The section from the
|
I opened XCode and got asked if I want to install additional components. |
I'm getting the same error too, in VS Code. I am running flutter from a non-admin account, using High Sierra 10.13.6. In VS Code:
I feel this issue should be raised higher in priority. I encountered it in my first hour of using flutter, I think there's an issues label for that? It blocks the hot reloading functionality for me. A more accurate title for this issue might be: "Hot reloading broken for iOS simulator when user is not admin". The exact error is easy to reproduce in terminal:
If I were to venture a guess at what the problem is, it seems that the "stream" feature of the /usr/bin/log utility can only be used by an admin user. This might be a recent change in MacOS. I'm not sure how this feature is used by flutter, it's not clear why the log output is being dumped to /dev/null. At any rate, the current workaround (your developer account needs to be an admin account) is clearly undesirable. |
I had this problem too. I solved it (somehow) by adding the following to my # Flutter
export PATH=~/flutter/bin:$PATH Then running |
The issues seems to be in this code: flutter/packages/flutter_tools/lib/src/ios/simulators.dart Lines 465 to 476 in 18e7549
For iOS >= 11 we call (cc @cbracken - it was a while ago, but you worked on this in #12079 - do you know if there might be any alternatives?) |
@DanTup do we know if the Flutter uses syslog (backed by os_log under the hood) for logging, and the mechanism for this changed in iOS 11, which meant we lost the ability to simply tail them out the way we had done in iOS 10 and earlier. One alternative to this approach would be for us to adopt a custom logging mechanism of our own design and stream those logs over a port exposed in the engine, which we'd then port-forward to the host, similar to what we do with observatory. |
Afraid I don't know (and couldn't find an answer to that when I looked). Both my MacBook's are up-to-date and that's the behaviour I see (I'm a Mac/Xcode newbie, I was looking at this just because it was raised against Dart Code).
Sounds like it should work (though I don't know enough about this to have a strong opinion), though I'm wondering Xcode is doing since this update for non-Admin users (presumably it's still showing the user logs)? |
This issue was blocking me to retrieve usable logs for a CI setup Dirty fix: sudo su
mkdir -p /foo/bin
cp /usr/bin/log /foo/bin
chmod u+s /foo/bin/log
LANG_SAVE=$LANG
export LANG=C
sed -i -e 's|/usr/bin/log|/foo/bin/log|g' /opt/flutter/bin/cache/flutter_tools.snapshot
export LANG=$LANG_SAVE Edit: 2019/07:
|
Hi Like to ask if anyone managed to slove this? Thanks |
Yes, it should |
Chiming in to say that I hit this issue myself. This was on a macbook where the account I was signed in as was not the primary account. Here's the verbose logs:
The app did launch with this issue, but we were never able to establish a connection to it, so we couldn't do thing like issue hot reload calls. |
I guess you launched in a "non debug" mode, so the VM wasn't paused at startup? (in VS Code, the default is to launch with the debugger, so I think this ends up with the user looking at a white screen because the VM is paused). |
Anyone give a solution to this issue? |
My workaround Change flutter/packages/flutter_tools/lib/src/ios/simulators.dart Lines 473 to 475 in 18e7549
to return runCommand(<String>[
'script', '/dev/null', 'sudo', '/usr/bin/log', 'stream', '--style', 'syslog', '--predicate', 'processImagePath CONTAINS "${device.id}"',
]); (add And add this rule to
and delete |
Anyone give a solution to this issue? |
@kentny ReactNative debbuger is an external tool, so I guess you havent installed it if you are not sure. Open a task manager on your device and check if its running |
If you don't have root access, you can debug the app in Xcode. At least you can check the debug messages and rebuild the app to check the changes, since hot reload won't work. |
Same issue. Any solutions? |
Workaround from @zoechi above works - thanks! |
0. my environment
1. fix
|
return runCommand(<String>[ | |
'script', '/dev/null', '/usr/bin/log', 'stream', '--style', 'syslog', '--predicate', 'processImagePath CONTAINS "${device.id}"', | |
]); |
to
return runCommand(<String>[
'script', '/dev/null', '/foo/bin/log', 'stream', '--style', 'syslog', '--predicate', 'processImagePath CONTAINS "${device.id}"',
]);
(use '/foo/bin/log'
)
and delete flutter/bin/cache
so it gets rebuilt
I'm getting this error because I'm working on a MacInCloud managed server plan which does not give you admin access. Besides this, everything else required for Flutter development seems to work in this environment, just except for the logging. |
I don't know the details of the mDNS changes so I'll have to defer to @dnfield... Should it replace the need for reading the logs with the |
No, that's only used for device finding. /Cc @jonahwilliams @zanderso |
How can I fix it? |
I am having this same issue and cannot run the simulator. Like ryanheise above< I am on a dev mac where I do not have admin access -- so I cannot try the fix zoechi suggested. Has there been any update on this? +1 |
Facing the same issue when running driver tests on CI 😞 |
Struggled with this problem for a good two weeks. Deleting flutter/bin/cache solved the issue. |
Hi are there any updates to this. |
God, I am so glad I stumbled over this advice after half a day of troubleshooting while trying to proceed on https://flutter.dev/docs/get-started/test-drive?tab=vscode. I was always getting a white screen on my simulated iOS device. After making sure that log runs with sudo, I was able to get the app to run and test hot reload. My setup: |
@christopherfujino @jmagman any advice on this issue? |
This doesn't work for real devices anyway. I wonder if there are permission issues with switching this to |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
@csterritt commented on Jun 12, 2018, 12:07 AM UTC:
Steps to Reproduce
Ran
flutter create first_try
, cd'd into that directory.flutter run
works, comes up fine in the iOS emulator. I can run in IntelliJ with the "Run" command (green triangle), but no hot-reload.If I run with "Debug" command (green bug), I get the empty white screen on the iOS emulator, and the following output:
Version info
This issue was moved by devoncarew from flutter/flutter-intellij/issues/2360.
The text was updated successfully, but these errors were encountered: