I want to change the rpath of an executable using install_name_tool
, but I can't figure out what the rpath is right now. install_name_tool
requires both the old and the new rpath's to be given on the commandline. What command can I use to print the rpath of an executable under macOS?
相关问题
- Xcode debugger displays incorrect values for varia
- Is there a way to report errors in Apple documenta
- Advice for supporting both Mac and Windows Desktop
- softlinks atime and mtime modification
- Avoid cmake to add the flags -search_paths_first a
相关文章
- 现在使用swift开发ios应用好还是swift?
- Visual Studio Code, MAC OS X, OmniSharp server is
- xcode 4 garbage collection removed?
- IntelliJ IDEA can't open projects or add SDK o
- Automator: How do I use the Choose from List actio
- ImportError: No module named twisted.persisted.sty
- How can I vertically align my status bar item text
- Emacs/xterm color annoyance on Linux
I found that I can print the install name of a shared library on macOS using
Moreover, I can set the install name directly without reference to the old install name by passing the
-id
flag toinstall_name_tool
:I just use otool command
It prints out the rpath field. No need for any long scripts.
I'm currently writing several Bash-3 scripts for processing DYLD and this one answers the question, so I post it for reference :
'hope it helps ;-)
NB: Does anyone know some Bash-3 tricks that can be useful for this script ?
You can use
otool -l myexecutable
, but this prints a lot of unnecessary information if you are interested only in the list of rpaths.You can filter the output of
otool -l
to the relevant rpath entries byFirst of all, understand that an executable doesn't contain a single
rpath
entry, but an array of one or more entries.Second, you can use
otool
to list an image'srpath
entries. Usingotool -l
, you'll get output like the following, at the very end of which are therpath
entries:Look for the
LC_RPATH
commands and note the path under thepath
entry.