Skip to content
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

idb integration is not working on M1 Macs #3497

Open
swrobel opened this issue Mar 4, 2022 · 12 comments
Open

idb integration is not working on M1 Macs #3497

swrobel opened this issue Mar 4, 2022 · 12 comments

Comments

@swrobel
Copy link

swrobel commented Mar 4, 2022

🐛 Bug Report

When idb is installed, regardless of the "Enable physical iOS devices" setting, Flipper prints the below warning over and over ad infinitum, and will not connect to simulator devices. Uninstalling idb resolves the issue. If you look at the last line of the log, it seems that it's attempting to look in the Intel Mac path for idb_companion, rather than the correct path when using the native version of homebrew on M1 macs.

Failed to query idb for targets: 
Error: Command failed: /opt/homebrew/bin/idb list-targets --json
killed: false
code: 1
signal: null
cmd: "/opt/homebrew/bin/idb list-targets --json"
stdout: ""
stderr: "2022-03-03 15:58:42,988 [ERROR] - root - Exception thrown in main
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.9/site-packages/idb/cli/main.py", line 313, in gen_main
    await root_command.run(args)
  File "/opt/homebrew/lib/python3.9/site-packages/idb/common/command.py", line 90, in run
    return await self.resolve_command_from_args(args).run(args)
  File "/opt/homebrew/lib/python3.9/site-packages/idb/cli/__init__.py", line 106, in run
    await self._run_impl(args)
  File "/opt/homebrew/lib/python3.9/site-packages/idb/cli/__init__.py", line 149, in _run_impl
    await self.run_with_manager(
  File "/opt/homebrew/lib/python3.9/site-packages/idb/cli/commands/target.py", line 188, in run_with_manager
    targets = await manager.list_targets(only=only)
  File "/opt/homebrew/lib/python3.9/site-packages/idb/common/logging.py", line 113, in _async_wrapper
    raise ex
  File "/opt/homebrew/lib/python3.9/site-packages/idb/common/logging.py", line 88, in _async_wrapper
    value = await function(*args, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/idb/grpc/management.py", line 197, in list_targets
    (local_targets, connected_targets) = await asyncio.gather(
  File "/opt/homebrew/lib/python3.9/site-packages/idb/grpc/management.py", line 195, in _list_local_targets
    return await companion.list_targets(only=only)
  File "/opt/homebrew/lib/python3.9/site-packages/idb/common/logging.py", line 113, in _async_wrapper
    raise ex
  File "/opt/homebrew/lib/python3.9/site-packages/idb/common/logging.py", line 88, in _async_wrapper
    value = await function(*args, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/idb/common/companion.py", line 383, in list_targets
    output = await self._run_companion_command(arguments=arguments, timeout=timeout)
  File "/opt/homebrew/lib/python3.9/site-packages/idb/common/companion.py", line 161, in _run_companion_command
    async with self._start_companion_command(arguments=arguments) as process:
  File "/opt/homebrew/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py", line 181, in __aenter__
    return await self.gen.__anext__()
  File "/opt/homebrew/lib/python3.9/site-packages/idb/common/companion.py", line 137, in _start_companion_command
    process = await asyncio.create_subprocess_exec(
  File "/opt/homebrew/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/subprocess.py", line 236, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
  File "/opt/homebrew/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 1661, in subprocess_exec
    transport = await self._make_subprocess_transport(
  File "/opt/homebrew/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/unix_events.py", line 197, in _make_subprocess_transport
    transp = _UnixSubprocessTransport(self, protocol, args, shell,
  File "/opt/homebrew/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_subprocess.py", line 36, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
  File "/opt/homebrew/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/unix_events.py", line 789, in _start
    self._proc = subprocess.Popen(
  File "/opt/homebrew/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/opt/homebrew/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/idb_companion'
"

Running the same command at a terminal works just fine:

$ /opt/homebrew/bin/idb list-targets --json
{"name": "Apple TV", "udid": "5793ACE1-D85C-49A7-AD2E-EE50F05D11B9", "state": "Shutdown", "type": "simulator", "os_version": "tvOS 15.2", "architecture": "x86_64"}
{"name": "Apple TV 4K (2nd generation)", "udid": "CD9395B9-7413-4A9C-BDD7-041FA40E5F9E", "state": "Shutdown", "type": "simulator", "os_version": "tvOS 15.2", "architecture": "x86_64"}
{"name": "Apple TV 4K (at 1080p) (2nd generation)", "udid": "8642BBF4-174D-4C2D-8516-207841F825F9", "state": "Shutdown", "type": "simulator", "os_version": "tvOS 15.2", "architecture": "x86_64"}
{"name": "Apple Watch Series 5 - 40mm", "udid": "2F8802E2-2DB0-4136-94E7-ED03DEFDC2FB", "state": "Shutdown", "type": "simulator", "os_version": "watchOS 8.3", "architecture": "i386"}
{"name": "Apple Watch Series 5 - 44mm", "udid": "F54F5E5C-5A4E-46CF-9B32-9DFA138B1BB1", "state": "Shutdown", "type": "simulator", "os_version": "watchOS 8.3", "architecture": "i386"}
{"name": "Apple Watch Series 6 - 40mm", "udid": "34D88C32-74E4-4A31-8D14-BD660D8E50B1", "state": "Shutdown", "type": "simulator", "os_version": "watchOS 8.3", "architecture": "i386"}
{"name": "Apple Watch Series 6 - 44mm", "udid": "EA945F5D-0D22-4894-A29E-3417C02F5E8F", "state": "Shutdown", "type": "simulator", "os_version": "watchOS 8.3", "architecture": "i386"}
{"name": "Apple Watch Series 7 - 41mm", "udid": "F06D629A-364E-42B5-A1BC-9CDAC3C91088", "state": "Shutdown", "type": "simulator", "os_version": "watchOS 8.3", "architecture": "x86_64"}
{"name": "Apple Watch Series 7 - 45mm", "udid": "A8232BEE-79B3-4BAF-885D-E5E84E097237", "state": "Shutdown", "type": "simulator", "os_version": "watchOS 8.3", "architecture": "x86_64"}
{"name": "iPad (9th generation)", "udid": "557D502C-3F20-4EBE-AE12-A6327DD400D9", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPad Air (4th generation)", "udid": "B2B8FEFE-6E95-4A99-ACD8-7C3D07669DED", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPad Pro (11-inch) (3rd generation)", "udid": "D1F8DEFA-C9D5-4AC6-AD93-911DF04B8296", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPad Pro (12.9-inch) (5th generation)", "udid": "B7847CFF-DA3E-47E6-83F4-7B6B076E7B50", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPad Pro (9.7-inch)", "udid": "1BB43C60-6DF1-4087-A947-4F83241BD8E1", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPad mini (6th generation)", "udid": "367C3B38-2AD4-4872-810D-3C8EF67E516F", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPhone 11", "udid": "2073346B-9972-4A30-8A33-527A01F9558B", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPhone 11 Pro", "udid": "339AE00B-7BB6-4FB7-A4E9-73937F4BBF92", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPhone 11 Pro Max", "udid": "171406A0-E26C-4053-9528-852326EB27A7", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPhone 12", "udid": "EE0AF0D7-FBFF-49B3-A9C1-B0253D1F0127", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPhone 12 Pro", "udid": "FE5CCAB1-7C98-45DF-84A5-FF056E170F96", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPhone 12 Pro Max", "udid": "CCC724AC-5C72-4E33-B6BF-708A2B6649A1", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPhone 12 mini", "udid": "EEC44688-3B27-4592-ABA4-35561BEECBA1", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPhone 13", "udid": "B51B7092-3417-48D2-9837-FFEEE39234E4", "state": "Booted", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPhone 13 Pro", "udid": "2936FB9E-2EC0-40E8-A4C4-15117BB9891D", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPhone 13 Pro Max", "udid": "E284C569-6204-4B69-93EE-08E4246D284F", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPhone 13 mini", "udid": "BD2FA393-08E6-45BB-95A1-39418E6A1E35", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPhone 8", "udid": "F7059D05-468C-414C-A60A-C1F83E8DF2D7", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPhone 8 Plus", "udid": "FA1DA038-7BE5-4FBB-97D6-F8B46F149424", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPhone SE (2nd generation)", "udid": "A8A7F3F9-4C6C-4C48-8D76-BCB425025AD7", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}
{"name": "iPod touch (7th generation)", "udid": "46A81DE7-CF73-4543-B3EB-87A9BA3A9560", "state": "Shutdown", "type": "simulator", "os_version": "iOS 15.2", "architecture": "x86_64"}

With idb installed:
Screen Shot 2022-03-03 at 4 06 47 PM

After uninstalling idb:
Screen Shot 2022-03-03 at 4 09 57 PM

To Reproduce (on M1 Mac)

  1. brew install idb-companion
  2. pip3 install fb-idb
  3. Run Flipper

Environment

macOS 12.2.1
Flipper 0.137.0

@Pickleboyonline
Copy link

I used a symbolic link at /usr/local/bin/idb_companion that points to /opt/homebrew/bin/idb_companion to get around this.

@zhaofang
Copy link

ln -s /opt/homebrew/bin/idb /usr/local/bin

@akinlekan28
Copy link

I am having this same issue on my M1 pro

@danieldunderfelt
Copy link

This issue is still present in 0.176 on MacOS Ventura 13.0.1 (M1 Max). The symlink method works, but Flipper should really support M1 macs.

@heath-clink
Copy link

This bug is actually in idb. See: facebook/idb#835

@renanmav
Copy link

can devs do something

@dieptx
Copy link

dieptx commented Dec 5, 2023

any update here? Still happened on chip M1 Pro 😭

@stanislavkhatko
Copy link

As you installed idb_companion with brew and idb with pip you need to link path of idb_companion to path of idb

ln -s /opt/homebrew/bin/idb_companion /usr/local/bin/idb_companion

@SamiChab
Copy link

SamiChab commented Jul 2, 2024

@stanislavkhatko exactly !
brew list idb-companion -> get the installation folder (/opt/homebrew/Cellar/idb-companion/1.1.8/bin/idb_companion for example)
Then : sudo ln -s /opt/homebrew/Cellar/idb-companion/1.1.8/bin/idb_companion /usr/local/bin
I had to previously add a link to idb in the same folder : sudo ln -s /Users/<user_name>/.local/bin/idb /usr/local/bin

@Mohammed-Aljasem
Copy link

SamiChab

You Saved my day, Thank you.

@vyhungle
Copy link

thank you @SamiChab

@kylanhurt
Copy link

This worked for me: sudo ln -s /opt/homebrew/bin/idb_companion /usr/local/bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests