在OS X上修复/ bin /可执行文件

时间:2016-09-21 18:07:01

标签: rpath zipalign

我相信“brew update”已经破坏了我的/ bin / zipalign - 因为之后它不再运行了。该框位于远程位置(10小时时区差异,在服务器框中,因此我无法获得推送cmd + r的物理访问权限)。我可以sudo,但这不能解决问题。

我该如何解决这个问题?

$ /bin/zipalign
dyld: warning, LC_RPATH @loader_path/../lib in /bin/zipalign being ignored in restricted program because of @loader_path
dyld: warning, LC_RPATH @loader_path/lib in /bin/zipalign being ignored in restricted program because of @loader_path
dyld: Library not loaded: @rpath/libc++.dylib
  Referenced from: /bin/zipalign
  Reason: image not found
Trace/BPT trap: 5

$ /Users/myuser/Library/Android/sdk/build-tools/23.0.1/zipalign
Zip alignment utility
Copyright (C) 2009 The Android Open Source Project
...
* So that works; I would like to have the that in /bin/zipalign; I though creating a symlink.

$ sudo rm -rf /bin/zipalign
rm: /bin/zipalign: Operation not permitted

$ otool -L /bin/zipalign
/bin/zipalign:
    @rpath/libc++.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

$ sudo install_name_tool -change @rpath/libc++.dylib /share/android/build-tools/23.0.1/lib/libc++.dylib /bin/zipalign
error: 
install_name_tool: can't open input file: /bin/zipalign for writing (Operation not permitted)

$ sudo csrutil disable
csrutil: failed to modify system integrity configuration. This tool needs to be executed from the Recovery OS.

这是一个Jenkins奴隶,访问:仅限ssh,可以sudo,无法触摸真正的键盘,我该如何解决?

1 个答案:

答案 0 :(得分:1)

因为它变成了解决方案:将文件复制到/ usr / bin并确保它优先于/ bin,然后拙劣的应用程序将无法运行。